@@ -1423,8 +1423,11 @@ object Types {
1423
1423
/** A marker trait for types that can be types of values or prototypes of value types */
1424
1424
trait ValueTypeOrProto extends TermType
1425
1425
1426
+ /** A marker trait for types that can be types of values or wildcards */
1427
+ trait ValueTypeOrWildcard extends TermType
1428
+
1426
1429
/** A marker trait for types that can be types of values or that are higher-kinded */
1427
- trait ValueType extends ValueTypeOrProto
1430
+ trait ValueType extends ValueTypeOrProto with ValueTypeOrWildcard
1428
1431
1429
1432
/** A marker trait for types that are guaranteed to contain only a
1430
1433
* single non-null value (they might contain null in addition).
@@ -2317,7 +2320,8 @@ object Types {
2317
2320
2318
2321
object AndType {
2319
2322
def apply (tp1 : Type , tp2 : Type )(implicit ctx : Context ): AndType = {
2320
- assert(tp1.isValueType && tp2.isValueType, i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
2323
+ assert(tp1.isInstanceOf [ValueTypeOrWildcard ] &&
2324
+ tp2.isInstanceOf [ValueTypeOrWildcard ], i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
2321
2325
unchecked(tp1, tp2)
2322
2326
}
2323
2327
@@ -2340,7 +2344,8 @@ object Types {
2340
2344
2341
2345
abstract case class OrType (tp1 : Type , tp2 : Type ) extends CachedGroundType with AndOrType {
2342
2346
2343
- assert(tp1.isInstanceOf [ValueType ] && tp2.isInstanceOf [ValueType ])
2347
+ assert(tp1.isInstanceOf [ValueTypeOrWildcard ] &&
2348
+ tp2.isInstanceOf [ValueTypeOrWildcard ], s " $tp1 $tp2" )
2344
2349
def isAnd = false
2345
2350
2346
2351
private [this ] var myJoin : Type = _
@@ -2375,7 +2380,8 @@ object Types {
2375
2380
unique(new CachedOrType (tp1, tp2))
2376
2381
}
2377
2382
def make (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Type =
2378
- if (tp1 eq tp2) tp1 else apply(tp1, tp2)
2383
+ if (tp1 eq tp2) tp1
2384
+ else apply(tp1, tp2)
2379
2385
}
2380
2386
2381
2387
// ----- ExprType and LambdaTypes -----------------------------------
@@ -3506,7 +3512,7 @@ object Types {
3506
3512
object TryDynamicCallType extends FlexType
3507
3513
3508
3514
/** Wildcard type, possibly with bounds */
3509
- abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with TermType {
3515
+ abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with ValueTypeOrWildcard {
3510
3516
def derivedWildcardType (optBounds : Type )(implicit ctx : Context ) =
3511
3517
if (optBounds eq this .optBounds) this
3512
3518
else if (! optBounds.exists) WildcardType
0 commit comments