Skip to content
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

Support injecting companion object #106

Closed
evant opened this issue Apr 12, 2021 · 0 comments · Fixed by #119
Closed

Support injecting companion object #106

evant opened this issue Apr 12, 2021 · 0 comments · Fixed by #119
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@evant
Copy link
Owner

evant commented Apr 12, 2021

This generates incorrect code

interface IFoo {
  @Inject
  companion object : IFoo
}

@Component
abstract class MyComponent {
   abstract val foo: IFoo
   val IFoo.Companion.bind: IFoo @Provides get() = this
}

expected:

class InjectMyComponent : MyComponent {
  override val foo: IFoo get() = IFoo.bind
}

actual:

class InjectMyComponent : MyComponent {
  override val foo: IFoo get() = IFoo.Companion().bind
}
@evant evant added good first issue Good for newcomers bug Something isn't working labels Apr 12, 2021
@evant evant changed the title Support object in the receiver position Support injecting companion object Apr 12, 2021
evant added a commit that referenced this issue Apr 19, 2021
evant added a commit that referenced this issue Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant