diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-07 04:38:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-07 04:38:25 +0000 |
commit | 2b31bc81adfe6470e7da4546a4858482e8a5b61f (patch) | |
tree | d629be4a40c1bdf7cd45926cc5938ea5a46b6b16 | |
parent | 05382e2351e1ec6ebfbb50c4df12a2b1410a0b80 (diff) | |
download | scala-2b31bc81adfe6470e7da4546a4858482e8a5b61f.tar.gz scala-2b31bc81adfe6470e7da4546a4858482e8a5b61f.tar.bz2 scala-2b31bc81adfe6470e7da4546a4858482e8a5b61f.zip |
Avoid some spurious errors after a cyclical ref...
Avoid some spurious errors after a cyclical reference error. Closes
SI-2388, no review.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 4 | ||||
-rw-r--r-- | test/files/neg/bug2388.check | 4 | ||||
-rw-r--r-- | test/files/neg/bug2388.scala | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7ae390a992..149763cf44 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3830,7 +3830,9 @@ trait Typers extends Modes with Adaptations { log(context.imports)//debug } if (inaccessibleSym eq NoSymbol) { - error(tree.pos, "not found: "+decodeWithKind(name, context.owner)) + // Avoiding some spurious error messages: see SI-2388. + if (reporter.hasErrors && (name startsWith tpnme.ANON_CLASS_NAME)) () + else error(tree.pos, "not found: "+decodeWithKind(name, context.owner)) } else new AccessError( tree, inaccessibleSym, context.enclClass.owner.thisType, diff --git a/test/files/neg/bug2388.check b/test/files/neg/bug2388.check new file mode 100644 index 0000000000..f96cb594d1 --- /dev/null +++ b/test/files/neg/bug2388.check @@ -0,0 +1,4 @@ +bug2388.scala:2: error: recursive method search needs result type + val searchField = new AnyRef { search() } + ^ +one error found diff --git a/test/files/neg/bug2388.scala b/test/files/neg/bug2388.scala new file mode 100644 index 0000000000..3634f346f8 --- /dev/null +++ b/test/files/neg/bug2388.scala @@ -0,0 +1,4 @@ +class Foo { + val searchField = new AnyRef { search() } + def search() = searchField +} |