Skip to content

Preventing double definition for anonymous givens #18034

Closed as not planned
Closed as not planned
@soronpo

Description

@soronpo

I'm not clear if this is indeed a bug, or a limitation that can be lifted with or without a SIP.

Compiler version

v3.3.0

Minimized code

https://scastie.scala-lang.org/7m7S5DcCQYeZioWaeM2Uqw

object One:
  trait Config

object Two:
  trait Config

given One.Config = ???
given Two.Config = ???

Output

Double definition:
final lazy given val given_Config: Playground.One.Config in object Playground at line 9 and
final lazy given val given_Config: Playground.Two.Config in object Playground at line 10

Expectation

I expect that the compiler will notice that both givens come from different paths and use them as a full name to prevent the double definition from occurring. So the compiler should desugar to:

final lazy given val given_One_Config = ???
final lazy given val given_Two_Config = ???

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions