summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2008-07-28 12:04:26 +0000
committerMartin Odersky <odersky@gmail.com>2008-07-28 12:04:26 +0000
commitf89b2673402c1d8cbd1b0c305d24d5fadda9ae95 (patch)
tree0f663078d6136985eecba1d48d76fd9951e92cbc /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentd492b489b176a3d2a4da0d199756af86514be352 (diff)
downloadscala-f89b2673402c1d8cbd1b0c305d24d5fadda9ae95.tar.gz
scala-f89b2673402c1d8cbd1b0c305d24d5fadda9ae95.tar.bz2
scala-f89b2673402c1d8cbd1b0c305d24d5fadda9ae95.zip
fixed #1022,#1030,#1033,#1036
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index d410bf6eee..a1c99aa049 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2384,7 +2384,10 @@ trait Typers { self: Analyzer =>
def typedReturn(expr: Tree) = {
val enclMethod = context.enclMethod
- if (enclMethod == NoContext || enclMethod.owner.isConstructor) {
+ if (enclMethod == NoContext ||
+ enclMethod.owner.isConstructor ||
+ context.enclClass.enclMethod == enclMethod // i.e., we are in a constructor of a local class
+ ) {
errorTree(tree, "return outside method definition")
} else {
val DefDef(_, _, _, _, restpt, _) = enclMethod.tree
@@ -2701,7 +2704,9 @@ trait Typers { self: Analyzer =>
}
val owntype =
if (mix.isEmpty) {
- if ((mode & SUPERCONSTRmode) != 0) clazz.info.parents.head
+ if ((mode & SUPERCONSTRmode) != 0)
+ if (clazz.info.parents.isEmpty) AnyRefClass.tpe // can happen due to cyclic references ==> #1036
+ else clazz.info.parents.head
else intersectionType(clazz.info.parents)
} else {
findMixinSuper(clazz.info)