Skip to content

val and single given pattern combination #12629

Closed
@bishabosha

Description

@bishabosha

Compiler version

3.0.0

Minimized code

case class A(i: Int)
case class B(b: Boolean)

def test =
  val (given A) = A(23)
  val given B = B(false)

Output

compiles ok

Expectation

val given B is treated as a pattern val def, but this is too close to given B = B(false) so I would expect a syntax error in favour of the alias given,

alternatively, with #11897 fixed, it could be a way to define a (non-lazy) given?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions