scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

Stateful weirdness in REPL reporting #12910

Closed som-snytt closed 6 months ago

som-snytt commented 7 months ago

Reproduction steps

scala 2.13.12> class C { def match = 42 }
                             ^
               error: identifier expected but 'match' found.

scala 2.13.12> class C { def `match` = 42 }
                                       ^
               warning: procedure syntax is deprecated: instead, add `: Unit` to explicitly declare `<error>`'s return type [quickfixable]
class C

scala 2.13.12> class C { def `match` = 42 }
class C

scala 2.13.12>

Problem

Explain how the above behavior isn't what you expected.

Well, explain to me how that could possibly be expected.

lrytz commented 7 months ago

rings a 🔔 https://github.com/scala/scala/pull/10474

som-snytt commented 7 months ago

aha

scala 2.13.12-20230817-134032-acab4f6> 42
val res0: Int = 42

scala 2.13.12-20230817-134032-acab4f6>  class C { def match = 42 }
                                                      ^
                                       error: identifier expected but 'match' found.

scala 2.13.12-20230817-134032-acab4f6> class C { def `match` = 42 }
class C

scala 2.13.12-20230817-134032-acab4f6>
som-snytt commented 6 months ago

I reopened when I realized lrytz's PR had no ticket. It simplifies my local bookkeeping.

If it needs to be said, by "stateful" weirdness, I did not mean "magisterial".