summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorphaller <philipp.haller@typesafe.com>2012-06-15 16:53:19 +0200
committerphaller <philipp.haller@typesafe.com>2012-06-15 16:53:19 +0200
commit51c92f02229098d0b402a65a72267f7a17984022 (patch)
tree8a9c99d097640190421c3a35ac1b0b6ddf18151f /src/compiler
parentcdfbe8e39fbbec00c969cd74f117ae410b98b40b (diff)
downloadscala-51c92f02229098d0b402a65a72267f7a17984022.tar.gz
scala-51c92f02229098d0b402a65a72267f7a17984022.tar.bz2
scala-51c92f02229098d0b402a65a72267f7a17984022.zip
Replace context stack of AnnotationChecker with new mode for typing returns
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Modes.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Modes.scala b/src/compiler/scala/tools/nsc/typechecker/Modes.scala
index 3eff5ef024..bde3ad98c9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Modes.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Modes.scala
@@ -86,6 +86,10 @@ trait Modes {
*/
final val TYPEPATmode = 0x10000
+ /** RETmode is set when we are typing a return expression.
+ */
+ final val RETmode = 0x20000
+
final private val StickyModes = EXPRmode | PATTERNmode | TYPEmode | ALTmode
final def onlyStickyModes(mode: Int) =
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 8f84431d52..1193d3013a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3987,9 +3987,7 @@ trait Typers extends Modes with Adaptations with Tags {
ReturnWithoutTypeError(tree, enclMethod.owner)
} else {
context.enclMethod.returnsSeen = true
- pushAnnotationContext(tree)
- val expr1: Tree = typed(expr, EXPRmode | BYVALmode, restpt.tpe)
- popAnnotationContext()
+ val expr1: Tree = typed(expr, EXPRmode | BYVALmode | RETmode, restpt.tpe)
// Warn about returning a value if no value can be returned.
if (restpt.tpe.typeSymbol == UnitClass) {