From 2b31bc81adfe6470e7da4546a4858482e8a5b61f Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 7 Aug 2011 04:38:25 +0000 Subject: Avoid some spurious errors after a cyclical ref... Avoid some spurious errors after a cyclical reference error. Closes SI-2388, no review. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 4 +++- test/files/neg/bug2388.check | 4 ++++ test/files/neg/bug2388.scala | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/files/neg/bug2388.check create mode 100644 test/files/neg/bug2388.scala 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 +} -- cgit v1.2.3