diff options
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 7 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 6fc1fb9dc..fc8876d09 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -364,9 +364,9 @@ class TypeApplications(val self: Type) extends AnyVal { val sym = self.parent.classSymbol if (sym.isLambdaTraitOBS) return sym.typeParams } - val precedingParams = self.parent.typeParams + val precedingParams = self.parent.typeParams.filterNot(_.memberName == self.refinedName) if (Config.newHK && self.isTypeParam) precedingParams :+ self - else precedingParams.filterNot(_.memberName == self.refinedName) + else precedingParams case self: RecType => self.parent.typeParams case self: SingletonType => diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index db41d85aa..dfe94de44 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -381,7 +381,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { compareRefined case tp2: RecType => val tp1stable = ensureStableSingleton(tp1) - isSubType(fixRecs(tp1stable, tp1stable.widenExpr), tp2.substRecThis(tp2, tp1stable)) + isSubType(fixRecs(tp1stable, tp1stable.widenExpr), tp2.parent.substRecThis(tp2, tp1stable)) case OrType(tp21, tp22) => // Rewrite T1 <: (T211 & T212) | T22 to T1 <: (T211 | T22) and T1 <: (T212 | T22) // and analogously for T1 <: T21 | (T221 & T222) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 33a94f5c7..34be65591 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1674,11 +1674,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def adaptType(tp: Type): Tree = { val tree1 = - if (pt != AnyTypeConstructorProto && tp.typeParamSymbols.nonEmpty) { - println(i"lam abs $tp with tparams ${tp.typeParamSymbols}%, %") - tree.withType(tree.tpe.EtaExpand(tp.typeParamSymbols)) - } - else tree + if ((pt eq AnyTypeConstructorProto) || tp.typeParamSymbols.isEmpty) tree + else tree.withType(tree.tpe.EtaExpand(tp.typeParamSymbols)) if ((ctx.mode is Mode.Pattern) || tree1.tpe <:< pt) tree1 else err.typeMismatch(tree1, pt) } |