11package dotty .tools .dotc .interactive
22
3+ import java .nio .charset .Charset
4+
35import dotty .tools .dotc .ast .Trees ._
46import dotty .tools .dotc .config .Printers .interactiv
57import dotty .tools .dotc .core .Contexts .{Context , NoContext }
@@ -10,13 +12,13 @@ import dotty.tools.dotc.core.Flags._
1012import dotty .tools .dotc .core .Names .{Name , TermName }
1113import dotty .tools .dotc .core .NameKinds .SimpleNameKind
1214import dotty .tools .dotc .core .NameOps .NameDecorator
13- import dotty .tools .dotc .core .Symbols .{defn , NoSymbol , Symbol }
15+ import dotty .tools .dotc .core .Symbols .{NoSymbol , Symbol , defn }
1416import dotty .tools .dotc .core .Scopes
1517import dotty .tools .dotc .core .StdNames .{nme , tpnme }
1618import dotty .tools .dotc .core .TypeError
17- import dotty .tools .dotc .core .Types .{NameFilter , NamedType , Type , NoType }
19+ import dotty .tools .dotc .core .Types .{NameFilter , NamedType , NoType , Type }
1820import dotty .tools .dotc .printing .Texts ._
19- import dotty .tools .dotc .util .{NoSourcePosition , SourcePosition }
21+ import dotty .tools .dotc .util .{NameTransformer , NoSourcePosition , SourcePosition }
2022
2123import scala .collection .mutable
2224
@@ -150,7 +152,8 @@ object Completion {
150152 nameToSymbols.map { case (name, symbols) =>
151153 val typesFirst = symbols.sortWith((s1, s2) => s1.isType && ! s2.isType)
152154 val desc = description(typesFirst)
153- Completion (name.toString, desc, typesFirst)
155+ val label = NameTransformer .decodeIllegalChars(name.toString)
156+ Completion (label, desc, typesFirst)
154157 }
155158 }
156159
@@ -207,11 +210,14 @@ object Completion {
207210 * considered.
208211 */
209212 def addMemberCompletions (qual : Tree )(implicit ctx : Context ): Unit = {
210- addAccessibleMembers(qual.tpe)
211- if (! mode.is(Mode .Import )) {
212- // Implicit conversions do not kick in when importing
213- implicitConversionTargets(qual)(ctx.fresh.setExploreTyperState())
214- .foreach(addAccessibleMembers)
213+ if (! qual.tpe.widenDealias.isBottomType) {
214+ addAccessibleMembers(qual.tpe)
215+ if (! mode.is(Mode .Import ) && ! qual.tpe.isRef(defn.NullClass )) {
216+ // Implicit conversions do not kick in when importing
217+ // and for `NullClass` they produce unapplicable completions (for unclear reasons)
218+ implicitConversionTargets(qual)(ctx.fresh.setExploreTyperState())
219+ .foreach(addAccessibleMembers)
220+ }
215221 }
216222 }
217223
0 commit comments