File tree 2 files changed +9
-2
lines changed
compiler/src/dotty/tools/dotc
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ class GadtConstraint private (
77
77
sym.name.is(NameKinds .UniqueName ) && {
78
78
val hi = sym.info.hiBound
79
79
! hi.isExactlyAny && self <:< hi
80
+ // drop any lower param that is a GADT symbol
81
+ // and is upper-bounded by a non-Any super-type of the original parameter
82
+ // e.g. in pos/i14287.min
83
+ // B$1 had info <: X and fullBounds >: B$2 <: X, and
84
+ // B$2 had info <: B$1 and fullBounds <: B$1
85
+ // We can use the info of B$2 to drop the lower-bound of B$1
86
+ // and return non-bidirectional bounds B$1 <: X and B$2 >: B$1.
80
87
}
81
88
}.foldLeft(nonParamBounds(param).lo) {
82
89
(t, u) => t | externalize(u)
@@ -88,7 +95,7 @@ class GadtConstraint private (
88
95
val sym = paramSymbol(p)
89
96
sym.name.is(NameKinds .UniqueName ) && {
90
97
val lo = sym.info.loBound
91
- ! lo.isExactlyNothing && lo <:< self
98
+ ! lo.isExactlyNothing && lo <:< self // same as fullLowerBounds
92
99
}
93
100
}.foldLeft(nonParamBounds(param).hi) { (t, u) =>
94
101
val eu = externalize(u)
Original file line number Diff line number Diff line change @@ -1765,7 +1765,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1765
1765
else report.error(new DuplicateBind (b, cdef), b.srcPos)
1766
1766
if (! ctx.isAfterTyper) {
1767
1767
val bounds = ctx.gadt.fullBounds(sym)
1768
- if (bounds != null ) sym.info = checkNonCyclic(sym, bounds, reportErrors = true )
1768
+ if (bounds != null ) sym.info = bounds
1769
1769
}
1770
1770
b
1771
1771
case t : UnApply if t.symbol.is(Inline ) => Inlines .inlinedUnapply(t)
You can’t perform that action at this time.
0 commit comments