diff options
-rw-r--r-- | src/dotty/tools/dotc/typer/EtaExpansion.scala | 4 | ||||
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/pos/pickleinf.scala | 9 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/EtaExpansion.scala b/src/dotty/tools/dotc/typer/EtaExpansion.scala index 4fa3d78eb..89415024e 100644 --- a/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -13,6 +13,7 @@ import Decorators._ import Names._ import StdNames._ import Trees._ +import Inferencing._ import util.Positions._ import collection.mutable @@ -24,7 +25,8 @@ object EtaExpansion { if (isPureExpr(expr)) expr else { val name = ctx.freshName(prefix).toTermName - val sym = ctx.newSymbol(ctx.owner, name, EmptyFlags, expr.tpe.widen, coord = positionCoord(expr.pos)) + val liftedType = fullyDefinedType(expr.tpe.widen, "lifted expression", expr.pos) + val sym = ctx.newSymbol(ctx.owner, name, EmptyFlags, liftedType, coord = positionCoord(expr.pos)) defs += ValDef(sym, expr) ref(sym.valRef) } diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 2b5b86be1..cf213033d 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -53,6 +53,7 @@ class tests extends CompilerTest { // This directory doesn't exist anymore // @Test def pickle_pickling = compileDir(coreDir, "pickling", testPickling) @Test def pickle_ast = compileDir(dotcDir, "ast", testPickling) + @Test def pickle_inf = compileFile(posDir, "pickleinf", testPickling) //@Test def pickle_core = compileDir(dotcDir, "core", testPickling, xerrors = 2) // two spurious comparison errors in Types and TypeOps diff --git a/tests/pos/pickleinf.scala b/tests/pos/pickleinf.scala new file mode 100644 index 000000000..9132f1a17 --- /dev/null +++ b/tests/pos/pickleinf.scala @@ -0,0 +1,9 @@ +class Bar[N] { + def bar(name: N, dummy: Int = 42): N = name +} + +object Test { + def test(): Unit = { + (new Bar).bar(10) + } +} |