diff options
author | phaller <hallerp@gmail.com> | 2012-08-12 17:17:54 +0200 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-08-12 17:17:54 +0200 |
commit | 834a8faa123f168e8baea772b06ebce2874ff431 (patch) | |
tree | e8a61c40476530b10ab676827d8fbaade812ba75 /src/compiler | |
parent | 47519b4eb6b4aec78e3c13e08811c7346c61acc4 (diff) | |
download | scala-834a8faa123f168e8baea772b06ebce2874ff431.tar.gz scala-834a8faa123f168e8baea772b06ebce2874ff431.tar.bz2 scala-834a8faa123f168e8baea772b06ebce2874ff431.zip |
Simplify the adaptation of types of return expressions
Add `adaptTypeOfReturn` hook to `AnnotationCheckers`.
Move adaptation of types of return expressions from `addAnnotations`
to `typedReturn` via `adaptTypeOfReturn` hook.
This resolves an inconsistency where previously types could have
a plus marker without additional CPS annotations. This also adds
additional test cases.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 79c1e660f0..8ba2d9e0fd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4096,7 +4096,8 @@ trait Typers extends Modes with Adaptations with Tags { if (typed(expr).tpe.typeSymbol != UnitClass) unit.warning(tree.pos, "enclosing method " + name + " has result type Unit: return value discarded") } - treeCopy.Return(tree, checkDead(expr1)) setSymbol enclMethod.owner setType NothingClass.tpe + treeCopy.Return(tree, checkDead(expr1)).setSymbol(enclMethod.owner) + .setType(adaptTypeOfReturn(expr1, restpt.tpe, NothingClass.tpe)) } } } |