Skip to content

Commit 32079ff

Browse files
committed
Restrict set of tokens after which a colon argument is allowed
Drop strings and quoted idents. That leaves: - alphanumeric identifiers, backticked identifiers, this, super, `)`, `]` This choice was made to keep the extension minimal. Quite a few files in the intent project have to be changed since they all use an idiom like "Formatting": ... with a colon after a string literal. We can discuss separately whether we want to support this, but IMO there's no pressing need to do so.
1 parent d4ddbeb commit 32079ff

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ object Tokens extends TokensCommon {
283283

284284
final val endMarkerTokens = identifierTokens | BitSet(IF, WHILE, FOR, MATCH, TRY, NEW, THROW, GIVEN, VAL, THIS)
285285

286-
final val colonEOLPredecessors = BitSet(RPAREN, RBRACKET, BACKQUOTED_IDENT, THIS, SUPER, QUOTEID, STRINGLIT)
286+
final val colonEOLPredecessors = BitSet(RPAREN, RBRACKET, BACKQUOTED_IDENT, THIS, SUPER)
287287

288288
final val closingParens = BitSet(RPAREN, RBRACKET, RBRACE)
289289

0 commit comments

Comments
 (0)