@@ -1417,8 +1417,11 @@ object Types {
1417
1417
/** A marker trait for types that can be types of values or prototypes of value types */
1418
1418
trait ValueTypeOrProto extends TermType
1419
1419
1420
+ /** A marker trait for types that can be types of values or wildcards */
1421
+ trait ValueTypeOrWildcard extends TermType
1422
+
1420
1423
/** A marker trait for types that can be types of values or that are higher-kinded */
1421
- trait ValueType extends ValueTypeOrProto
1424
+ trait ValueType extends ValueTypeOrProto with ValueTypeOrWildcard
1422
1425
1423
1426
/** A marker trait for types that are guaranteed to contain only a
1424
1427
* single non-null value (they might contain null in addition).
@@ -2311,7 +2314,8 @@ object Types {
2311
2314
2312
2315
object AndType {
2313
2316
def apply (tp1 : Type , tp2 : Type )(implicit ctx : Context ): AndType = {
2314
- assert(tp1.isValueType && tp2.isValueType, i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
2317
+ assert(tp1.isInstanceOf [ValueTypeOrWildcard ] &&
2318
+ tp2.isInstanceOf [ValueTypeOrWildcard ], i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
2315
2319
unchecked(tp1, tp2)
2316
2320
}
2317
2321
@@ -2334,7 +2338,8 @@ object Types {
2334
2338
2335
2339
abstract case class OrType (tp1 : Type , tp2 : Type ) extends CachedGroundType with AndOrType {
2336
2340
2337
- assert(tp1.isInstanceOf [ValueType ] && tp2.isInstanceOf [ValueType ])
2341
+ assert(tp1.isInstanceOf [ValueTypeOrWildcard ] &&
2342
+ tp2.isInstanceOf [ValueTypeOrWildcard ], s " $tp1 $tp2" )
2338
2343
def isAnd = false
2339
2344
2340
2345
private [this ] var myJoin : Type = _
@@ -2369,7 +2374,8 @@ object Types {
2369
2374
unique(new CachedOrType (tp1, tp2))
2370
2375
}
2371
2376
def make (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Type =
2372
- if (tp1 eq tp2) tp1 else apply(tp1, tp2)
2377
+ if (tp1 eq tp2) tp1
2378
+ else apply(tp1, tp2)
2373
2379
}
2374
2380
2375
2381
// ----- ExprType and LambdaTypes -----------------------------------
@@ -3500,7 +3506,7 @@ object Types {
3500
3506
object TryDynamicCallType extends FlexType
3501
3507
3502
3508
/** Wildcard type, possibly with bounds */
3503
- abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with TermType {
3509
+ abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with ValueTypeOrWildcard {
3504
3510
def derivedWildcardType (optBounds : Type )(implicit ctx : Context ) =
3505
3511
if (optBounds eq this .optBounds) this
3506
3512
else if (! optBounds.exists) WildcardType
0 commit comments