From b89874b7c0bb9ad8e2276b652580f3aaf3e5c621 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 9 Sep 2015 21:45:04 +1000 Subject: Fix REPL completion of symbolic identifiers Recover part of the identifier that preceded the cursor from the source, rather than from the name in the `Select` node, which might contains an encoded name that differs in length from the one in source. --- test/junit/scala/tools/nsc/interpreter/CompletionTest.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/junit') diff --git a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala index 177d4922fb..514f30571e 100644 --- a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala +++ b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala @@ -48,7 +48,14 @@ class CompletionTest { checkExact(completer, """class C { asInstanceO""")("asInstanceOf") // Output is sorted - assertEquals(List("prefix_aaa", "prefix_nnn", "prefix_zzz"), completer.complete("""class C { def prefix_nnn = 0; def prefix_zzz = 0; def prefix_aaa = 0; prefix_""").candidates) + assertEquals(List("prefix_aaa", "prefix_nnn", "prefix_zzz"), completer.complete( """class C { def prefix_nnn = 0; def prefix_zzz = 0; def prefix_aaa = 0; prefix_""").candidates) + } + + @Test + def symbolically(): Unit = { + val intp = newIMain() + val completer = new PresentationCompilerCompleter(intp) + checkExact(completer, """class C { def +++(a: Any) = 0; def ---(a: Any) = 0; this.++""")("+++") } @Test -- cgit v1.2.3