File tree 3 files changed +30
-9
lines changed
compiler/src/dotty/tools/dotc/core
3 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -483,16 +483,21 @@ object SymDenotations {
483
483
recur(owner.asClass.givenSelfType)
484
484
end setAlias
485
485
486
+ def split (tp : Type ): (Type , TypeBounds ) = tp match
487
+ case AnnotatedType (alias, Annotation .WithBounds (bounds)) =>
488
+ (alias, bounds)
489
+ case tp : HKTypeLambda =>
490
+ val (alias1, bounds1) = split(tp.resType)
491
+ (tp.derivedLambdaType(resType = alias1),
492
+ HKTypeLambda .boundsFromParams(tp.typeParams, bounds1))
493
+ case _ =>
494
+ (tp, HKTypeLambda .boundsFromParams(tp.typeParams, TypeBounds .empty))
495
+
486
496
info match
487
- case TypeAlias (alias) if isOpaqueAlias && owner.isClass =>
488
- val bounds = alias match
489
- case AnnotatedType (alias1, Annotation .WithBounds (bounds)) =>
490
- setAlias(alias1)
491
- bounds
492
- case _ =>
493
- setAlias(alias)
494
- TypeBounds .empty
495
- HKTypeLambda .boundsFromParams(alias.typeParams, bounds)
497
+ case TypeAlias (tp) if isOpaqueAlias && owner.isClass =>
498
+ val (alias, bounds) = split(tp)
499
+ setAlias(alias)
500
+ bounds
496
501
case _ =>
497
502
info
498
503
end opaqueToBounds
Original file line number Diff line number Diff line change
1
+ object opaque {
2
+ opaque type Foo [X ] <: String = String
3
+ }
4
+ object test {
5
+ val s : String = ??? .asInstanceOf [opaque.Foo [String ]]
6
+ }
7
+ object opaque2 {
8
+ opaque type Foo2 <: String = String
9
+ }
10
+ object test2 {
11
+ val s : String = " bla"
12
+ }
Original file line number Diff line number Diff line change
1
+ object O {
2
+ opaque type First [A1 ] = A1
3
+ opaque type Last [A ] = A
4
+ }
You can’t perform that action at this time.
0 commit comments