Skip to content
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

val (name: T) = rhs is mistakenly parsed the same as val name: T = rhs #8211

Open
scabug opened this issue Jan 30, 2014 · 4 comments
Open

val (name: T) = rhs is mistakenly parsed the same as val name: T = rhs #8211

scabug opened this issue Jan 30, 2014 · 4 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) parser
Milestone

Comments

@scabug
Copy link

scabug commented Jan 30, 2014

According to scala spec we have two following syntax endpoints that start with val keyword:

Dcl               ::=  `val' ValDcl | ...
ValDcl            ::=  ids `:' Type

PatVarDef         ::=  `val' PatDef | ...
PatDef            ::=  Pattern2 {`,' Pattern2} [`:' Type] `=' Expr

From here it's easy to see that val followed by a parenthesis can only mean a pattern which implies runtime type check rather than current compile-time one.

@scabug
Copy link
Author

scabug commented Jan 30, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8211?orig=1
Reporter: @densh
Affected Versions: 2.11.0-M8
See #8202, #900

@scabug
Copy link
Author

scabug commented Jan 30, 2014

@densh said:
Possible fix densh/scala@3c203bc

@scabug
Copy link
Author

scabug commented Feb 6, 2014

@xeno-by said:
@Denys, Jason. This needs a summary of our today's discussion.

@scabug
Copy link
Author

scabug commented Feb 6, 2014

@densh said:
After discussion today the conclusion was that this behavior will not change in 2.11 but should be discussed again in 2.12 cycle.

@scabug scabug added the parser label Apr 7, 2017
@scabug scabug added this to the Backlog milestone Apr 7, 2017
@som-snytt som-snytt changed the title val (name: T) = rhs is mistakingly parsed the same as val name: T = rhs val (name: T) = rhs is mistakenly parsed the same as val name: T = rhs Dec 13, 2018
@som-snytt som-snytt added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) parser
Projects
None yet
Development

No branches or pull requests

3 participants