Skip to content

false double definition error of exported transparent inline #13476

Closed
@soronpo

Description

@soronpo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions