Skip to content

Commit

Permalink
Fix scala#7655: [ can start an expression
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Dec 2, 2019
1 parent 65a404f commit 011321e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Tokens.scala
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ object Tokens extends TokensCommon {
USCORE, NULL, THIS, SUPER, TRUE, FALSE, RETURN, QUOTEID, XMLSTART)

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

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

Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i7655.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object bug2 {
val id: [U] => U => U = [U] => (none: U) => none
val id1: [U] => U => U = { [U] => (none: U) => none }
val id2: [U] => U => U =
[U] => (none: U) => none
}

0 comments on commit 011321e

Please sign in to comment.