Skip to content

Pattern given on the LHS of a val definition should enter corresponding scope #11897

@LPTK

Description

@LPTK

Compiler version

3.0.0-RC1

Minimized code

scala> given Int = 0
lazy val given_Int: Int

scala> def test = {
     |   val (x, given Int) = (1, 1)
     |   summon[Int]
     | }
def test: Int

scala> test                                                                                                             
val res0: Int = 0

Expectation

This is quite surprising/unexpected.

I would expect it to work in the same way as the following:

scala> def test = {
     |   given Int = 1
     |   summon[Int]
     | }
def test: Int

scala> test
val res1: Int = 1

Metadata

Metadata

Assignees

Labels

area:desugarDesugaring happens after parsing but before typing, see desugar.scalaitype:enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions