aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala14
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala6
2 files changed, 10 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 13b900e18..b76cce58d 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -248,12 +248,12 @@ class TypeComparer(initctx: Context) extends DotClass {
case _ =>
false
}
- case tp2 @ ExprType(restpe1) =>
+ case tp2 @ ExprType(restpe2) =>
tp1 match {
- case tp1 @ ExprType(restpe2) =>
+ case tp1 @ ExprType(restpe1) =>
isSubType(restpe1, restpe2)
case _ =>
- false
+ isSubType(tp1, restpe2)
}
case TypeBounds(lo2, hi2) =>
tp1 match {
@@ -288,9 +288,11 @@ class TypeComparer(initctx: Context) extends DotClass {
case _ => false
}))
case tp1: SingletonType =>
- isSubType(tp1.underlying, tp2)
- case tp1: ExprType =>
- isSubType(tp1.underlying, tp2)
+ val underlying = tp1.underlying match {
+ case underlying: ExprType => underlying.resultType
+ case underlying => underlying
+ }
+ isSubType(underlying, tp2)
case tp1: RefinedType =>
isSubType(tp1.parent, tp2)
case AndType(tp11, tp12) =>
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 673791d8d..3216e8b74 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -473,15 +473,13 @@ trait Applications extends Compatibility { self: Typer =>
case Select(qual, name) =>
tryEither { implicit ctx =>
val qual1 = adapt(qual, new SelectionProto(name, proto))
- if (qual1.tpe.isError) qual1
- else {
- assert(qual1 ne qual, s"$qual1 : ${qual1.tpe}")
+ if (qual1.tpe.isError || (qual1 eq qual)) qual1
+ else
typedApply(
cpy.Apply(tree,
cpy.Select(fun1, untpd.TypedSplice(qual1), name),
proto.typedArgs map untpd.TypedSplice),
pt)
- }
} { _ => failed.commit()
}
case _ =>