summaryrefslogtreecommitdiff
path: root/src/continuations
diff options
context:
space:
mode:
authorphaller <hallerp@gmail.com>2012-08-20 14:35:03 +0200
committerphaller <hallerp@gmail.com>2012-08-20 14:39:45 +0200
commitcd14c3087ceca8145c3013c2751648b936f1256d (patch)
treef9d00c3a699a79871d249dcee936b5220556f442 /src/continuations
parent834a8faa123f168e8baea772b06ebce2874ff431 (diff)
downloadscala-cd14c3087ceca8145c3013c2751648b936f1256d.tar.gz
scala-cd14c3087ceca8145c3013c2751648b936f1256d.tar.bz2
scala-cd14c3087ceca8145c3013c2751648b936f1256d.zip
Improve doc comment on adaptTypeOfReturn in CPSAnnotationChecker
Diffstat (limited to 'src/continuations')
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala
index eb96f87e0e..b373b3d0de 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala
@@ -232,9 +232,13 @@ abstract class CPSAnnotationChecker extends CPSUtils with Modes {
} else tree
}
- // only adapt type if this return will
- // (a) be removed (in tail position and method's result type (pt) is cps type), or
- // (b) cause an error
+ /** Returns an adapted type for a return expression if the method's result type (pt) is a CPS type.
+ * Otherwise, it returns the `default` type (`typedReturn` passes `NothingClass.tpe`).
+ *
+ * A return expression in a method that has a CPS result type is an error unless the return
+ * is in tail position. Therefore, we are making sure that only the types of return expressions
+ * are adapted which will either be removed, or lead to an error.
+ */
override def adaptTypeOfReturn(tree: Tree, pt: Type, default: => Type): Type = {
// only adapt if method's result type (pt) is cps type
val annots = cpsParamAnnotation(pt)