Skip to content

Fix #4539: Add missing '[ in canStartExpressionTokens #5815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -212,7 +212,7 @@ object Tokens extends TokensCommon {
USCORE, NULL, THIS, SUPER, TRUE, FALSE, RETURN, XMLSTART)

final val canStartExpressionTokens: TokenSet = atomicExprTokens | BitSet(
LBRACE, LPAREN, QBRACE, QPAREN, IF, DO, WHILE, FOR, NEW, TRY, THROW)
LBRACE, LPAREN, QBRACE, QPAREN, QBRACKET, IF, DO, WHILE, FOR, NEW, TRY, THROW)

final val canStartTypeTokens: TokenSet = literalTokens | identifierTokens | BitSet(
THIS, SUPER, USCORE, LPAREN, AT)
Expand Down
7 changes: 7 additions & 0 deletions compiler/test-resources/repl/i4539
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
scala> val a = '[Int]
val a: quoted.Type[Int] = Type(Int)
scala> '[Int]
val res0: quoted.Type[Int] = Type(Int)
scala> '[Int]; '[Int]
val res1: quoted.Type[Int] = Type(Int)
val res2: quoted.Type[Int] = Type(Int)
4 changes: 4 additions & 0 deletions tests/pos/i4539.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Foo {
val q = '[String]
'[String]
}
21 changes: 21 additions & 0 deletions tests/pos/i4539b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
object Foo {
def f = {
{
'[String]
'[String]
}

'[String] match { case _ => }
try '[String] catch { case _ => }

'[String]
'[String]
}

def bar[T](t: quoted.Type[T]) = ???
bar('[String])

class Baz[T](t: quoted.Type[T])
new Baz('[String])

}