File tree 4 files changed +39
-7
lines changed
compiler/src/dotty/tools/dotc
4 files changed +39
-7
lines changed Original file line number Diff line number Diff line change @@ -1065,7 +1065,7 @@ object desugar {
1065
1065
AppliedTypeTree (ref(seqType), t),
1066
1066
New (ref(defn.RepeatedAnnotType ), Nil :: Nil ))
1067
1067
} else {
1068
- assert(ctx.mode.isExpr || ctx.reporter.hasErrors, ctx.mode)
1068
+ assert(ctx.mode.isExpr || ctx.reporter.hasErrors || ctx.mode.is( Mode . Interactive ) , ctx.mode)
1069
1069
Select (t, op.name)
1070
1070
}
1071
1071
case PrefixOp (op, t) =>
Original file line number Diff line number Diff line change @@ -475,12 +475,17 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
475
475
isSubType(tp1.resType, tp2.resType.subst(tp2, tp1))
476
476
finally comparedTypeLambdas = saved
477
477
case _ =>
478
- if (! tp1.isHK) {
479
- tp2 match {
480
- case EtaExpansion (tycon2) if tycon2.symbol.isClass =>
481
- return isSubType(tp1, tycon2)
482
- case _ =>
483
- }
478
+ if (tp1.isHK) {
479
+ val tparams1 = tp1.typeParams
480
+ return isSubType(
481
+ HKTypeLambda .fromParams(tparams1, tp1.appliedTo(tparams1.map(_.paramRef))),
482
+ tp2
483
+ )
484
+ }
485
+ else tp2 match {
486
+ case EtaExpansion (tycon2) if tycon2.symbol.isClass =>
487
+ return isSubType(tp1, tycon2)
488
+ case _ =>
484
489
}
485
490
fourthTry(tp1, tp2)
486
491
}
Original file line number Diff line number Diff line change
1
+ class Foo [+ X [_]] {
2
+ // OK
3
+ def foo1 [Y [_]](right : Foo [Y ]): Foo [Y ] = right
4
+ // OK
5
+ def foo2 [Y [_]](right : Foo [[T ] => Y [T ]]): Foo [Y ] = right
6
+ // OK
7
+ def foo3 [Y [_]](right : Foo [[T ] => Y [T ]]): Foo [[T ] => Y [T ]] = right
8
+ // Error:
9
+ // found: Foo[Y](right)
10
+ // required: Foo[Y]
11
+ def foo4 [Y [_]](right : Foo [Y ]): Foo [[T ] => Y [T ]] = right
12
+ }
Original file line number Diff line number Diff line change
1
+ object App {
2
+ def main (args : Array [String ]): Unit = {
3
+ trait ModuleSig {
4
+ type F [_]
5
+ type Type = F
6
+
7
+ def subst [F [_[_]]](fa : F [List ]): F [Type ]
8
+ }
9
+ val Module : ModuleSig = new ModuleSig {
10
+ type F [+ A ] = List [A ]
11
+
12
+ def subst [FF [_[_]]](fa : FF [List ]): FF [Type ] = fa
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments