Skip to content

Commit a746215

Browse files
committed
Address review comments
1 parent 5677dfc commit a746215

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ object Completion {
4646
private def completionMode(path: List[Tree], pos: SourcePosition): Mode = {
4747
path match {
4848
case (ref: RefTree) :: _ =>
49-
if (ref.name == tpnme.ERROR) Mode.Type
50-
else if (ref.name == nme.ERROR) Mode.Term
51-
else if (ref.name.isTermName) Mode.Term
49+
if (ref.name.isTermName) Mode.Term
5250
else if (ref.name.isTypeName) Mode.Type
5351
else Mode.None
5452

@@ -220,20 +218,9 @@ object Completion {
220218
!sym.is(allOf(Mutable, Accessor)) &&
221219
(
222220
(mode.is(Mode.Term) && sym.isTerm)
223-
|| (mode.is(Mode.StableTerm) && sym.isTerm && validPathSegment(sym))
224-
|| (mode.is(Mode.Type) && sym.isType)
221+
|| (mode.is(Mode.Type) && (sym.isType || sym.isStable))
225222
)
226223

227-
/** Can this symbol be part of a path? See SLS 3.1 for a definition of a valid path. */
228-
private def validPathSegment(sym: Symbol)(implicit ctx: Context): Boolean = {
229-
def isRealizable = {
230-
val realizability = CheckRealizable.realizability(sym.info)
231-
realizability == CheckRealizable.Realizable
232-
}
233-
234-
!sym.is(Method) && isRealizable
235-
}
236-
237224
/**
238225
* Find all the members of `site` that are accessible and which should be included in `info`.
239226
*
@@ -310,13 +297,11 @@ object Completion {
310297
/** Term symbols are allowed */
311298
val Term: Mode = new Mode(1)
312299

313-
val StableTerm: Mode = new Mode(2)
314-
315-
/** Type symbols are allowed */
316-
val Type: Mode = new Mode(4) | StableTerm
300+
/** Type and stable term symbols are allowed */
301+
val Type: Mode = new Mode(2)
317302

318303
/** Both term and type symbols are allowed */
319-
val Import: Mode = new Mode(8) | Term | Type
304+
val Import: Mode = new Mode(4) | Term | Type
320305
}
321306

322307
}

0 commit comments

Comments
 (0)