File tree 2 files changed +27
-3
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ final class ProperGadtConstraint private(
124
124
125
125
// The replaced symbols are picked up here.
126
126
addToConstraint(poly1, tvars)
127
- .reporting(i " added to constraint: $params%, % \n $debugBoundsDescription" , gadts)
127
+ .reporting(i " added to constraint: [ $poly1 ] $params%, % \n $debugBoundsDescription" , gadts)
128
128
}
129
129
130
130
override def addBound (sym : Symbol , bound : Type , isUpper : Boolean )(implicit ctx : Context ): Boolean = {
@@ -237,8 +237,11 @@ final class ProperGadtConstraint private(
237
237
}
238
238
239
239
override def fullUpperBound (param : TypeParamRef )(implicit ctx : Context ): Type =
240
- constraint.minUpper(param).foldLeft(nonParamBounds(param).hi) {
241
- (t, u) => t & externalize(u)
240
+ constraint.minUpper(param).foldLeft(nonParamBounds(param).hi) { (t, u) =>
241
+ val eu = externalize(u)
242
+ // Any as the upper bound means "no bound", but if F is higher-kinded,
243
+ // Any & F = F[_]; this is wrong for us so we need to short-circuit
244
+ if t.isAny then eu else t & eu
242
245
}
243
246
244
247
// ---- Private ----------------------------------------------------------
Original file line number Diff line number Diff line change
1
+ object test {
2
+
3
+ enum KSUB [- F [_], + G [_]] {
4
+ case Refl [S [_]]() extends KSUB [S , S ]
5
+ }
6
+
7
+ enum Thing [+ F [_]] {
8
+ case LBOption () extends Thing [Option ];
9
+ case
10
+ }
11
+
12
+ def foo [F [_]](ksub : Option KSUB F ) =
13
+ ksub match {
14
+ case KSUB .Refl () =>
15
+ // we have (s is type parameter of KSUB.Refl):
16
+ // f >: Option
17
+ // s <: f
18
+ val fi : F [Int ] = Option (0 )
19
+ ()
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments