Skip to content

Commit 3cc436a

Browse files
authored
Merge pull request #7656 from dotty-staging/fix-#7655
Fix #7655: `[` can start an expression
2 parents 738613a + 011321e commit 3cc436a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ object Tokens extends TokensCommon {
220220
USCORE, NULL, THIS, SUPER, TRUE, FALSE, RETURN, QUOTEID, XMLSTART)
221221

222222
final val canStartExprTokens3: TokenSet = atomicExprTokens | BitSet(
223-
LBRACE, LPAREN, INDENT, QUOTE, IF, WHILE, FOR, NEW, TRY, THROW)
223+
LBRACE, LPAREN, LBRACKET, INDENT, QUOTE, IF, WHILE, FOR, NEW, TRY, THROW)
224224

225225
final val canStartExprTokens2: TokenSet = canStartExprTokens3 | BitSet(DO)
226226

tests/pos/i7655.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object bug2 {
2+
val id: [U] => U => U = [U] => (none: U) => none
3+
val id1: [U] => U => U = { [U] => (none: U) => none }
4+
val id2: [U] => U => U =
5+
[U] => (none: U) => none
6+
}

0 commit comments

Comments
 (0)