aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-10-09 14:35:44 +0200
committerGuillaume Martres <smarter@ubuntu.com>2015-10-19 18:07:18 +0200
commit78488cba57f5bfdf3181a8e6df5be2b290ebf564 (patch)
tree7775be08080affb590400d0fcb3ba87f4d2ab9a3
parentbea9aa282c7a929fdab815b3f34d2d697ade7bca (diff)
downloaddotty-78488cba57f5bfdf3181a8e6df5be2b290ebf564.tar.gz
dotty-78488cba57f5bfdf3181a8e6df5be2b290ebf564.tar.bz2
dotty-78488cba57f5bfdf3181a8e6df5be2b290ebf564.zip
Always fully define the types of lifted expressions
Fixes #822
-rw-r--r--src/dotty/tools/dotc/typer/EtaExpansion.scala4
-rw-r--r--test/dotc/tests.scala1
-rw-r--r--tests/pos/pickleinf.scala9
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)
+ }
+}