Skip to content

Commit 4ab0c68

Browse files
committed
Make TypeLambdas not be ValueTypes
1 parent 93d4c8c commit 4ab0c68

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/dotty/tools/dotc/core/OrderingConstraint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
393393
val replacement = tp.dealias.stripTypeVar
394394
if (param == replacement) this
395395
else {
396-
assert(replacement.isValueType)
396+
assert(replacement.isValueTypeOrLambda)
397397
val poly = param.binder
398398
val idx = param.paramNum
399399

src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
533533
case OrType(tp1, tp2) => isNullable(tp1) || isNullable(tp2)
534534
case _ => false
535535
}
536-
(tp1.symbol eq NothingClass) && tp2.isInstanceOf[ValueType] ||
536+
(tp1.symbol eq NothingClass) && tp2.isValueTypeOrLambda ||
537537
(tp1.symbol eq NullClass) && isNullable(tp2)
538538
}
539539
case tp1: SingletonType =>

src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ object Types {
9696
/** Is this type a value type? */
9797
final def isValueType: Boolean = this.isInstanceOf[ValueType]
9898

99+
/** Is the is value type or type lambda? */
100+
final def isValueTypeOrLambda: Boolean = isValueType || this.isInstanceOf[TypeLambda]
101+
99102
/** Does this type denote a stable reference (i.e. singleton type)? */
100103
final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
101104
case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable
@@ -2203,7 +2206,7 @@ object Types {
22032206

22042207
object AndType {
22052208
def apply(tp1: Type, tp2: Type)(implicit ctx: Context) = {
2206-
assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType], i"$tp1 & $tp2 / " + s"$tp1 & $tp2")
2209+
assert(tp1.isValueType && tp2.isValueType, i"$tp1 & $tp2 / " + s"$tp1 & $tp2")
22072210
unchecked(tp1, tp2)
22082211
}
22092212
def unchecked(tp1: Type, tp2: Type)(implicit ctx: Context) = {

src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ trait Implicits { self: Typer =>
412412
&& !to.isError
413413
&& !ctx.isAfterTyper
414414
&& (ctx.mode is Mode.ImplicitsEnabled)
415-
&& from.isInstanceOf[ValueType]
415+
&& from.isValueType
416416
&& ( from.isValueSubType(to)
417417
|| inferView(dummyTreeOfType(from), to)
418418
(ctx.fresh.addMode(Mode.ImplicitExploration).setExploreTyperState)

0 commit comments

Comments
 (0)