aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-13 13:21:54 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-13 15:14:23 +0100
commitb350d209a20ebdf583d1dd2d3fdcd3be5073d2ef (patch)
tree6a607e7eb4a375d3b01b2700e267848a6cef13bf /src/dotty/tools/dotc/typer
parent88f24efb2858f46c146214bc7e51f5de17c31bc0 (diff)
downloaddotty-b350d209a20ebdf583d1dd2d3fdcd3be5073d2ef.tar.gz
dotty-b350d209a20ebdf583d1dd2d3fdcd3be5073d2ef.tar.bz2
dotty-b350d209a20ebdf583d1dd2d3fdcd3be5073d2ef.zip
Perform variance adaptation only when needed in isSubType
Previously adaptIfHK was performed on every type application. This made t3152 fail. We now do this only on demand, in isSubType. t3152 now passes again. But the change unmasked another error, which makes Iter2 fail to compile.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index c6053d0fd..941b35d71 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -614,7 +614,7 @@ trait Applications extends Compatibility { self: Typer =>
}
def adaptTypeArg(tree: tpd.Tree, bound: Type)(implicit ctx: Context): tpd.Tree =
- tree.withType(tree.tpe.adaptIfHK(bound))
+ tree.withType(tree.tpe.etaExpandIfHK(bound))
/** Rewrite `new Array[T](....)` trees to calls of newXYZArray methods. */
def convertNewArray(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = tree match {
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index fedbc98b8..ca37614bf 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -853,7 +853,7 @@ class Namer { typer: Typer =>
val tycon = tp.withoutArgs(args)
val tycon1 = this(tycon)
val tparams = tycon.typeParams
- val args1 = if (args.length == tparams.length) adaptArgs(tparams, args) else args
+ val args1 = if (args.length == tparams.length) etaExpandIfHK(tparams, args) else args
if ((tycon1 eq tycon) && (args1 eq args)) tp else tycon1.appliedTo(args1)
} else mapOver(tp)
case _ => mapOver(tp)