summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-19 13:42:35 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-01-20 10:01:49 +1000
commitc30ed29f6cee9d4e0bd4a99c4be804ffcb20d281 (patch)
tree86a7c2814cc74c2f39b25b8d83bf0f6a65156427 /src
parent783c5ccfe7c2b22f1a1bdf6530028eac0d941702 (diff)
downloadscala-c30ed29f6cee9d4e0bd4a99c4be804ffcb20d281.tar.gz
scala-c30ed29f6cee9d4e0bd4a99c4be804ffcb20d281.tar.bz2
scala-c30ed29f6cee9d4e0bd4a99c4be804ffcb20d281.zip
SI-9093 Fix value discarding / multiple param list crasher
The type error stemming from missing argument list was being swallowed when the expected type was `Unit` and there were undetermined type parameters in the expression. This commit modifies `adapt` to avoid using `instantiateExpectingUnit` when the tree is typed with `MethodType`.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index e6fa9a0142..9773028b76 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1177,7 +1177,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
}
def instantiatePossiblyExpectingUnit(tree: Tree, mode: Mode, pt: Type): Tree = {
- if (mode.typingExprNotFun && pt.typeSymbol == UnitClass)
+ if (mode.typingExprNotFun && pt.typeSymbol == UnitClass && !tree.tpe.isInstanceOf[MethodType])
instantiateExpectingUnit(tree, mode)
else
instantiate(tree, mode, pt)