Skip to content

Commit b1c4e05

Browse files
authored
Don't crash when update is used as a modifier outside cc (#24378)
We now treat update like erased and consume. The error message is still not great, maybe something can be done about that.
2 parents 32bfd5f + 86ad423 commit b1c4e05

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Tokens.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ object Tokens extends TokensCommon {
301301

302302
final val closingParens = BitSet(RPAREN, RBRACKET, RBRACE)
303303

304-
final val softModifierNames = Set(nme.inline, nme.into, nme.opaque, nme.open, nme.transparent, nme.infix, nme.update)
304+
final val softModifierNames = Set(nme.inline, nme.into, nme.opaque, nme.open, nme.transparent, nme.infix)
305+
// Note: update, consume and erased are missing here since they are only modifiers under some import
305306

306307
def showTokenDetailed(token: Int): String = debugString(token)
307308

tests/neg/i24371.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class M extends caps.Mutable:
2+
update def foo = () // error // error
3+
4+

0 commit comments

Comments
 (0)