File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
compiler/src/dotty/tools/dotc/core
neg-custom-args/allow-deep-subtypes Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -926,10 +926,13 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
926926 then
927927 isSubType(base, tp2, if (tp1.isRef(cls2)) approx else approx.addLow)
928928 && recordGadtUsageIf { MatchType .thatReducesUsingGadt(tp1) }
929- || base.isInstanceOf [OrType ] && fourthTry
930- // if base is a disjunction, this might have come from a tp1 type that
929+ || base.isInstanceOf [AndOrType ] && fourthTry
930+ // If base is a disjunction, this might have come from a tp1 type that
931931 // expands to a match type. In this case, we should try to reduce the type
932932 // and compare the redux. This is done in fourthTry
933+ // If base is a conjunction, it could be that one of the original
934+ // branches of the AndType tp1 conforms to tp2, but its base type does
935+ // not. So we need to also fall back to fourthTry. Test case is i18226a.scala.
933936 else fourthTry
934937 end tryBaseType
935938
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ object Main {
2020
2121 def testHasThisType (): Unit = {
2222 def testSelf [PThis <: HasThisType [_ <: PThis ]](that : HasThisType [PThis ]): Unit = {
23- val thatSelf = that.self() // error: recursion limit exceeded
23+ val thatSelf = that.self()
2424 // that.self().type <: that.This
2525 assert(implicitly[thatSelf.type <:< that.This ] != null )
2626 }
Original file line number Diff line number Diff line change 1+ class Has [A ]
2+ trait Foo
3+
4+ class TestAspect [+ LowerR , - UpperR ]
5+
6+ class Spec [- R ] {
7+ def foo [R1 <: R ](aspect : TestAspect [R1 , R1 ]): Unit = {}
8+ }
9+
10+ class SuiteBuilder [R <: Has [_]] {
11+ def toSpec (
12+ spec : Spec [R & Has [Foo ]],
13+ aspect : TestAspect [
14+ R & Has [Foo ],
15+ R & Has [Foo ]
16+ ]
17+ ) =
18+ spec.foo(aspect)
19+ }
You can’t perform that action at this time.
0 commit comments