Skip to content

completion of back-ticked members does not give backticks in REPL #14006

Closed
@bjornregnell

Description

@bjornregnell

Compiler version

3.1.0

Minimized code and output

Welcome to Scala 3.1.0 (11.0.11, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                
scala> enum BT { case `back-tick thing` }
// defined class BT
                                                                                
scala> BT.back-tick thing   //completed after pressing TAB on BT.back<TAB>
-- Error:
1 |BT.back-tick thing
  |^^^^^^^^^^^^
  |postfix operator `thing` needs to be enabled
  |by making the implicit value scala.language.postfixOps visible.
  |----
  |This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |or by setting the compiler option -language:postfixOps.
  |See the Scaladoc for value scala.language.postfixOps for a discussion
  |why the feature needs to be explicitly enabled.

Expectation

The completion of back-ticked names should be wrapped into back-ticks so that the code works. A beginner might not know the rules of an identifier and a back-ticked member not following the rules is silently showing up in the list of completions. This may cause confusion.

It would also be nice if completion worked also after typing a back-tick.

scala> BT.`back-tick thing`  // completion does not work
val res0: BT = back-tick thing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions