diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 21:56:39 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 21:56:39 -0700 |
commit | 16576bfc73f5cc890eea9510df08372532121c46 (patch) | |
tree | ba834507a2ebed832d8a1f365fd513a9560d597f | |
parent | 9100f240624c14b6d5d5d4476e794b387d7b7143 (diff) | |
parent | 91214dad841ee04e01d064da276e3fe46edf9e31 (diff) | |
download | scala-16576bfc73f5cc890eea9510df08372532121c46.tar.gz scala-16576bfc73f5cc890eea9510df08372532121c46.tar.bz2 scala-16576bfc73f5cc890eea9510df08372532121c46.zip |
Merge pull request #2765 from retronym/ticket/7689
SI-7689 Fix typing regression with default arguments
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t7689.scala | 7 |
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 +} |