Skip to content

Commit

Permalink
Backport "fix: report correct location on a repeat modifier" to LTS (#…
Browse files Browse the repository at this point in the history
…19026)

Backports #17982 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
Kordyjan committed Dec 8, 2023
2 parents 5f01616 + 6fb812a commit fd42513
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3028,7 +3028,9 @@ object Parsers {
val name = in.name
val mod = atSpan(in.skipToken()) { modOfToken(tok, name) }

if (mods.isOneOf(mod.flags)) syntaxError(RepeatedModifier(mod.flags.flagsString))
if mods.isOneOf(mod.flags) then
syntaxError(RepeatedModifier(mod.flags.flagsString), mod.span)

addMod(mods, mod)
}

Expand Down
6 changes: 6 additions & 0 deletions tests/neg/i17981.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- [E015] Syntax Error: tests/neg/i17981.scala:1:6 ---------------------------------------------------------------------
1 |final final case class Foo() // error
| ^^^^^
| Repeated modifier final
|
| longer explanation available when compiling with `-explain`
1 change: 1 addition & 0 deletions tests/neg/i17981.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
final final case class Foo() // error

0 comments on commit fd42513

Please sign in to comment.