Skip to content

false double definition error of exported transparent inline #13476

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

Closed
soronpo opened this issue Sep 5, 2021 · 1 comment · Fixed by #13484
Closed

false double definition error of exported transparent inline #13476

soronpo opened this issue Sep 5, 2021 · 1 comment · Fixed by #13484

Comments

@soronpo
Copy link
Contributor

soronpo commented Sep 5, 2021

The necessary ingredients for this error:

  • (at least) two exported inline definitions. The one called should be transparent.
  • The object containing the definitions needs to be private.

Compiler version

v3.1.0-RC1

Minimized code

private object Foo:
  inline def d(arg : Int): Unit = {}
  transparent inline def haha() : Unit = {}

export Foo.*

@main def main : Unit = haha()

Output

[error] 1 |private object Foo:
[error]   |^
[error]   |Double definition:
[error]   |def inline$Foo(): Foo in package object Main$package at line 1 and
[error]   |def inline$Foo(): Foo in package object Main$package at line 1
[error]   |have the same type after erasure.
[error]   |
[error]   |Consider adding a @targetName annotation to one of the conflicting definitions
[error]   |for disambiguation.
[error] one error found

Expectation

No error.

@nicolasstucki
Copy link
Contributor

We only generate one tree for inline$Foo, maybe we are registering a second symbol.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 7, 2021
Accessors that are added to packages were removed to early from `accessedBy`.
This resulted in a new symbol beeing entered for the same accessor.

Fixes scala#13476
olsdavis pushed a commit to olsdavis/dotty that referenced this issue Apr 4, 2022
Accessors that are added to packages were removed to early from `accessedBy`.
This resulted in a new symbol beeing entered for the same accessor.

Fixes scala#13476
@Kordyjan Kordyjan added this to the 3.1.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants