Skip to content

Disable old context function syntax #10786

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 5 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 2 additions & 7 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1904,10 +1904,7 @@ object Parsers {

def expr(location: Location): Tree = {
val start = in.offset
def isSpecialClosureStart =
val lookahead = in.LookaheadScanner()
lookahead.nextToken()
lookahead.isIdent(nme.using) || lookahead.token == ERASED
def isSpecialClosureStart = in.lookahead.token == ERASED
if in.token == IMPLICIT then
closure(start, location, modifiers(BitSet(IMPLICIT)))
else if in.token == LPAREN && isSpecialClosureStart then
Expand Down Expand Up @@ -2137,9 +2134,7 @@ object Parsers {
else
openParens.change(LPAREN, 1)
var mods1 = mods
if mods.flags.isEmpty then
if isIdent(nme.using) then mods1 = addMod(mods1, atSpan(in.skipToken()) { Mod.Given() })
if in.token == ERASED then mods1 = addModifier(mods1)
if in.token == ERASED then mods1 = addModifier(mods1)
try
commaSeparated(() => binding(mods1))
finally
Expand Down
2 changes: 2 additions & 0 deletions tests/neg/context-function-syntax.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
val test =
(using x: Int) => x // error // error