summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala3
-rw-r--r--test/files/pos/t7689.scala7
2 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 1282cfb416..e8a1e8e85a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -35,7 +35,8 @@ trait Namers extends MethodSynthesis {
}
def apply(tree: Tree) = {
val r = transform(tree)
- if (r.exists(_.isEmpty)) TypeTree()
+ if (r exists { case tt: TypeTree => tt.isEmpty case _ => false })
+ TypeTree()
else r
}
}
diff --git a/test/files/pos/t7689.scala b/test/files/pos/t7689.scala
new file mode 100644
index 0000000000..022e7ab7a0
--- /dev/null
+++ b/test/files/pos/t7689.scala
@@ -0,0 +1,7 @@
+object A {
+ // The default getter must have an explicit return type (List[_] => Int)
+ // This wasn't happening since e28c3edda4. That commit encoded upper/lower
+ // bounds of Any/Nothing as EmptyTree, which were triggering an .isEmpty
+ // check in Namers#TypeTreeSubstitutor
+ def x(f: List[_] => Int = _ => 3) = 9
+}