Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickfixes don't include escapes when needed #12942

Open
coreywoodfield opened this issue Feb 6, 2024 · 4 comments
Open

quickfixes don't include escapes when needed #12942

coreywoodfield opened this issue Feb 6, 2024 · 4 comments
Milestone

Comments

@coreywoodfield
Copy link

Reproduction steps

Scala version: 2.13.12

In Test.scala:

trait Trait {
  def foo: Any
}
class Test extends Trait{
  case object `val`

  override def foo = `val`
}

When you run scalac -quickfix:any -Xsource:3 Test.scala, the file gets updated to

trait Trait {
  def foo: Any
}
class Test extends Trait{
  case object `val`

  override def foo: Test.this.val.type = `val`
}

which does not compile (the val in the type should be surrounded with backticks)

Problem

Quickfixes should escape keywords as needed

@som-snytt
Copy link

Printing with backticks would solve related tickets in REPL and autocomplete.

@SethTisue
Copy link
Member

attn @lrytz

@lrytz lrytz added this to the 2.13.14 milestone Feb 9, 2024
@lrytz
Copy link
Member

lrytz commented Feb 9, 2024

We could special case keywords (80 / 20), that idea is in tree printers https://github.com/scala/scala/blob/v2.13.12/src/reflect/scala/reflect/internal/Printers.scala#L34.

Alternatively sprinkle the BackquotedIdentifierAttachment attachement more widely. @som-snytt wdyt?

Either way, I don't see this as a blocker for 2.13.13.

@lrytz
Copy link
Member

lrytz commented Feb 9, 2024

@SethTisue SethTisue modified the milestones: 2.13.14, 2.13.15 Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants