diff options
author | Dmitry Petrashko <dark@d-d.me> | 2015-10-23 10:31:51 +0200 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2015-10-23 10:31:51 +0200 |
commit | 73f725c361a8d990d698c0aeb6889e272759ebeb (patch) | |
tree | 34c5eb76764513df653ca52820bfc2eb2711eba9 /src | |
parent | 344f8499be5f4705c8bd7c9aad45d04d760d3dda (diff) | |
parent | 3898deafe17eaf5e96387d02c58e4cc74f90838f (diff) | |
download | dotty-73f725c361a8d990d698c0aeb6889e272759ebeb.tar.gz dotty-73f725c361a8d990d698c0aeb6889e272759ebeb.tar.bz2 dotty-73f725c361a8d990d698c0aeb6889e272759ebeb.zip |
Merge pull request #832 from dotty-staging/fix-#815-hk-constructor-alias
Fix #815.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 78cefb2d4..6510ba35b 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -345,7 +345,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val clsDef = TypeDef(x, templ).withFlags(Final) typed(cpy.Block(tree)(clsDef :: Nil, New(Ident(x), Nil)), pt) case _ => - val tpt1 = typedType(tree.tpt) + var tpt1 = typedType(tree.tpt) + if (tpt1.tpe.isHK) { + val deAliased = tpt1.tpe.dealias.EtaReduce + if (deAliased.exists && deAliased.ne(tpt1.tpe)) + tpt1 = tpt1.withType(deAliased) + } checkClassTypeWithStablePrefix(tpt1.tpe, tpt1.pos, traitReq = false) assignType(cpy.New(tree)(tpt1), tpt1) // todo in a later phase: checkInstantiatable(cls, tpt1.pos) |