diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 23 | ||||
-rw-r--r-- | test/files/presentation/t7548.check | 1 | ||||
-rw-r--r-- | test/files/presentation/t7548/Test.scala | 17 | ||||
-rw-r--r-- | test/files/presentation/t7548/src/Foo.scala | 7 |
4 files changed, 39 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 49f6cb2373..b4e8170b19 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -247,16 +247,21 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") println("something's wrong: no "+context.unit+" in "+result+result.pos) located = result } - throw new TyperResult(located) + located.tpe match { + case _: OverloadedType => () + case _ => throw new TyperResult(located) + } } - try { - checkForMoreWork(old.pos) - } catch { - case ex: ValidateException => // Ignore, this will have been reported elsewhere - debugLog("validate exception caught: "+ex) - case ex: Throwable => - log.flush() - throw ex + else { + try { + checkForMoreWork(old.pos) + } catch { + case ex: ValidateException => // Ignore, this will have been reported elsewhere + debugLog("validate exception caught: "+ex) + case ex: Throwable => + log.flush() + throw ex + } } } } diff --git a/test/files/presentation/t7548.check b/test/files/presentation/t7548.check new file mode 100644 index 0000000000..5bfb0d27fe --- /dev/null +++ b/test/files/presentation/t7548.check @@ -0,0 +1 @@ +(x: Int)Unit diff --git a/test/files/presentation/t7548/Test.scala b/test/files/presentation/t7548/Test.scala new file mode 100644 index 0000000000..94a6048056 --- /dev/null +++ b/test/files/presentation/t7548/Test.scala @@ -0,0 +1,17 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + override protected def loadSources() { /* don't parse or typecheck sources */ } + + import compiler._ + + override def runDefaultTests() { + val res = new Response[Tree] + val pos = compiler.rangePos(sourceFiles.head, 102,102,102) + compiler.askTypeAt(pos, res) + res.get match { + case Left(tree) => compiler.ask(() => reporter.println(tree.tpe)) + case Right(ex) => reporter.println(ex) + } + } +} diff --git a/test/files/presentation/t7548/src/Foo.scala b/test/files/presentation/t7548/src/Foo.scala new file mode 100644 index 0000000000..cc997f6e5f --- /dev/null +++ b/test/files/presentation/t7548/src/Foo.scala @@ -0,0 +1,7 @@ +object Foo { + def foo(x: Int) = {} + def foo(x: String) = {} + def foo(x: Int, y: String) = {} + + foo(2) +}
\ No newline at end of file |