Skip to content

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

Open
@scabug

Description

@scabug

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)help wantedparser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions