Skip to content

Conflicting declarations with multiple identical overrides #309

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
damianw opened this issue Sep 6, 2023 · 0 comments · Fixed by #326
Closed

Conflicting declarations with multiple identical overrides #309

damianw opened this issue Sep 6, 2023 · 0 comments · Fixed by #326
Labels
bug Something isn't working
Milestone

Comments

@damianw
Copy link

damianw commented Sep 6, 2023

Code such as the following:

class MyDep

interface Provisioner {

    @Provides
    fun provideMyDep() = MyDep()
}

interface Accessor1 {

    val myDep: MyDep
}

interface Accessor2 {

    val myDep: MyDep
}

@Component
interface MyComponent : Provisioner, Accessor1, Accessor2

Generates the following:

public fun KClass<MyComponent>.create(): MyComponent = InjectMyComponent()

public class InjectMyComponent : MyComponent {
  public override val myDep: MyDep
    get() = provideMyDep()

  public override val myDep: MyDep
    get() = provideMyDep()
}

The override should only be generated once, as this code cannot be compiled:

Conflicting declarations: public open val myDep: MyDep, public open val myDep: MyDep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants