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
926
926
then
927
927
isSubType(base, tp2, if (tp1.isRef(cls2)) approx else approx.addLow)
928
928
&& 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
931
931
// expands to a match type. In this case, we should try to reduce the type
932
932
// 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.
933
936
else fourthTry
934
937
end tryBaseType
935
938
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ object Main {
20
20
21
21
def testHasThisType (): Unit = {
22
22
def testSelf [PThis <: HasThisType [_ <: PThis ]](that : HasThisType [PThis ]): Unit = {
23
- val thatSelf = that.self() // error: recursion limit exceeded
23
+ val thatSelf = that.self()
24
24
// that.self().type <: that.This
25
25
assert(implicitly[thatSelf.type <:< that.This ] != null )
26
26
}
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