summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/UnCurry.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-09-10 13:12:27 +0000
committerMartin Odersky <odersky@gmail.com>2007-09-10 13:12:27 +0000
commitb907c8eb599b53d83b2494e63a928182ec97f2eb (patch)
tree525ad28a003906f9c493595f84e5ec4a977cfc88 /src/compiler/scala/tools/nsc/transform/UnCurry.scala
parentc9e92bfc89083227aa18f88b07688afd625970af (diff)
downloadscala-b907c8eb599b53d83b2494e63a928182ec97f2eb.tar.gz
scala-b907c8eb599b53d83b2494e63a928182ec97f2eb.tar.bz2
scala-b907c8eb599b53d83b2494e63a928182ec97f2eb.zip
1. added var pattern = expr syntax
2. better error messages in two situations 3. fixed tickets 5, 33, 42 4. changed check files of 3 failing tests
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/UnCurry.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 96ded10df1..5427debfd0 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -134,11 +134,9 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
// ------- Handling non-local returns -------------------------------------------------
- /** The type of a non-local return expression for given method */
- private def nonLocalReturnExceptionType(meth: Symbol) =
- appliedType(
- NonLocalReturnExceptionClass.typeConstructor,
- List(meth.tpe.finalResultType))
+ /** The type of a non-local return expression with given argument type */
+ private def nonLocalReturnExceptionType(argtype: Type) =
+ appliedType(NonLocalReturnExceptionClass.typeConstructor, List(argtype))
/** A hashmap from method symbols to non-local return keys */
private val nonLocalReturnKeys = new HashMap[Symbol, Symbol]
@@ -162,7 +160,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
localTyper.typed {
Throw(
New(
- TypeTree(nonLocalReturnExceptionType(meth)),
+ TypeTree(nonLocalReturnExceptionType(expr.tpe)),
List(List(Ident(nonLocalReturnKey(meth)), expr))))
}
@@ -181,7 +179,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
*/
private def nonLocalReturnTry(body: Tree, key: Symbol, meth: Symbol) = {
localTyper.typed {
- val extpe = nonLocalReturnExceptionType(meth)
+ val extpe = nonLocalReturnExceptionType(meth.tpe.finalResultType)
val ex = meth.newValue(body.pos, nme.ex) setInfo extpe
val pat = Bind(ex,
Typed(Ident(nme.WILDCARD),