File tree Expand file tree Collapse file tree 4 files changed +49
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 4 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -1244,8 +1244,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
12441244 tl => otherTycon.appliedTo(bodyArgs(tl)))
12451245 else
12461246 otherTycon
1247- (assumedTrue(tycon) || directionalIsSubType(tycon, adaptedTycon)) &&
1248- directionalRecur(adaptedTycon.appliedTo(args), other)
1247+ rollbackConstraintsUnless :
1248+ (assumedTrue(tycon) || directionalIsSubType(tycon, adaptedTycon))
1249+ && directionalRecur(adaptedTycon.appliedTo(args), other)
12491250 }
12501251 }
12511252 end compareAppliedTypeParamRef
Original file line number Diff line number Diff line change 1+ class Box [T ](val value : T )
2+
3+ def boo [F [_], A ](e : F [Box [A ]]): F [A ] = ???
4+
5+ type Result [G [_], B ] = G [Box [B ]]
6+
7+ def main =
8+ val b : Result [Option , Int ] = ???
9+ val c = boo(b)
10+ c : Option [Int ]
Original file line number Diff line number Diff line change 1+ trait TCl [F [_]]
2+
3+ def boo [F [_], A ](e : F [Option [A ]], ev : TCl [F ]): Unit = ()
4+
5+ type Result [F [_], A ] = F [Option [A ]]
6+
7+ @ main def main =
8+ summon[Result [Option , Int ] =:= Option [Option [Int ]]]
9+
10+ val ev = new TCl [Option ] {}
11+
12+ val b : Result [Option , Int ] = None
13+ boo(b, ev)
14+
15+ val b2 : Option [Option [Int ]] = None
16+ boo(b2, ev)
Original file line number Diff line number Diff line change 1+ object Main {
2+ trait TCl [F [_]]
3+
4+ implicit class Stx [F [_], A ](e : F [Option [A ]]) {
5+ def boo (implicit ev : TCl [F ]): Unit = ()
6+ }
7+
8+ type Result [F [_], A ] = F [Option [A ]]
9+
10+ implicit val t : TCl [Option ] = new TCl [Option ] {}
11+
12+ def main (args : Array [String ]): Unit = {
13+ val b : Result [Option , Int ] = None
14+ b.boo
15+
16+ // works without the alias:
17+ val b2 : Option [Option [Int ]] = None
18+ b2.boo
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments