scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Implicit parameters in function expressions can't specify type #3672

Closed scabug closed 13 years ago

scabug commented 14 years ago

This compiles:

def foo(f: Int => Int) = () ; foo { implicit x => x + 1 }

This does not:

def foo(f: Int => Int) = () ; foo { implicit x : Int => x + 1 }
error: '=>' expected but ':' found.
scabug commented 14 years ago

Imported From: https://issues.scala-lang.org/browse/SI-3672?orig=1 Reporter: Bruce Mitchener (bruce)

scabug commented 14 years ago

@retronym said: These are the variations that currently work: http://git.jetbrains.org/?p=idea/scala-plugin.git;a=blob;f=test/org/jetbrains/plugins/scala/lang/parser/data/stmts/implicitClosureParams.test;h=f32e60393f12658b79ecd6188c09d406e9274033;hb=HEAD

Here is the reverse-engineered BNF: http://git.jetbrains.org/?p=idea/scala-plugin.git;a=blob;f=src/org/jetbrains/plugins/scala/lang/parser/parsing/expressions/Expr1.scala;h=ada39c0268ea5d70b4b3d9aefeeba28f0c6668a0;hb=HEAD

This differs from the grammar in Syntax Summary of the spec.

scabug commented 14 years ago

@odersky said: (In r23282) Closes #3672. Review by extempore.

scabug commented 14 years ago

@retronym said: A spec update + test would be appreciated. We need to keep the parser in IntelliJ up to date.

scabug commented 14 years ago

@odersky said: Yes, I am about to check a new version of the spec in, as well as a test.

scabug commented 14 years ago

@retronym said: Thanks a lot, I've noted the required changes for IntelliJ: http://youtrack.jetbrains.net/issue/SCL-2441