@@ -3,6 +3,7 @@ package dotty.tools.dotc.interactive
3
3
import dotty .tools .dotc .ast .Trees ._
4
4
import dotty .tools .dotc .config .Printers .interactiv
5
5
import dotty .tools .dotc .core .Contexts .{Context , NoContext }
6
+ import dotty .tools .dotc .core .CheckRealizable
6
7
import dotty .tools .dotc .core .Decorators .StringInterpolators
7
8
import dotty .tools .dotc .core .Denotations .SingleDenotation
8
9
import dotty .tools .dotc .core .Flags ._
@@ -13,7 +14,7 @@ import dotty.tools.dotc.core.Symbols.{defn, NoSymbol, Symbol}
13
14
import dotty .tools .dotc .core .Scopes
14
15
import dotty .tools .dotc .core .StdNames .{nme , tpnme }
15
16
import dotty .tools .dotc .core .TypeError
16
- import dotty .tools .dotc .core .Types .{NamedType , NameFilter , Type , takeAllFilter }
17
+ import dotty .tools .dotc .core .Types .{NamedType , Type , takeAllFilter }
17
18
import dotty .tools .dotc .printing .Texts ._
18
19
import dotty .tools .dotc .util .{NoSourcePosition , SourcePosition }
19
20
@@ -219,9 +220,20 @@ object Completion {
219
220
! sym.is(allOf(Mutable , Accessor )) &&
220
221
(
221
222
(mode.is(Mode .Term ) && sym.isTerm)
223
+ || (mode.is(Mode .StableTerm ) && sym.isTerm && validPathSegment(sym))
222
224
|| (mode.is(Mode .Type ) && sym.isType)
223
225
)
224
226
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
+
225
237
/**
226
238
* Find all the members of `site` that are accessible and which should be included in `info`.
227
239
*
@@ -298,11 +310,13 @@ object Completion {
298
310
/** Term symbols are allowed */
299
311
val Term : Mode = new Mode (1 )
300
312
313
+ val StableTerm : Mode = new Mode (2 )
314
+
301
315
/** Type symbols are allowed */
302
- val Type : Mode = new Mode (2 )
316
+ val Type : Mode = new Mode (4 ) | StableTerm
303
317
304
318
/** Both term and type symbols are allowed */
305
- val Import : Mode = new Mode (4 ) | Term | Type
319
+ val Import : Mode = new Mode (8 ) | Term | Type
306
320
}
307
321
308
322
}
0 commit comments