Skip to content

Commit 2e57cea

Browse files
committed
tests & use _name.toString
1 parent 73ac067 commit 2e57cea

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ object Interactive {
219219
case _ => getScopeCompletions(ctx)
220220
}
221221
interactiv.println(i"completion with pos = $pos, prefix = $prefix, termOnly = $termOnly, typeOnly = $typeOnly = ${completions.toList}%, %")
222-
(completionPos, completions.toList.sortBy(_.name.show))
222+
(completionPos, completions.toList.sortBy(_.name.toString))
223223
}
224224

225225
/** Possible completions of members of `prefix` which are accessible when called inside `boundary` */

compiler/test/dotty/tools/repl/TabcompleteTests.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,14 @@ class TabcompleteTests extends ReplTest {
6565
List("\"", ")", "'", "¨", "£", ":", ",", ";", "@", "}", "[", "]")
6666
.foreach(src => assertTrue(tabComplete(src).suggestions.isEmpty))
6767
}
68+
69+
@Test def sortedCompletions: Unit =
70+
fromInitialState { implicit state =>
71+
val src = """class Foo { def comp1 = 1; def compa = 3; def compA = 4 }"""
72+
compiler.compile(src).stateOrFail
73+
}
74+
.andThen { implicit state =>
75+
val expected = List("comp1", "compA", "compa")
76+
assertEquals(expected, tabComplete("(new Foo).comp").suggestions)
77+
}
6878
}

0 commit comments

Comments
 (0)