Skip to content

ContributeSubComponent: Support returning Super Type#1070

Open
esafirm wants to merge 2 commits intosquare:mainfrom
esafirm:contributesubcomponent-factory-return-super
Open

ContributeSubComponent: Support returning Super Type#1070
esafirm wants to merge 2 commits intosquare:mainfrom
esafirm:contributesubcomponent-factory-return-super

Conversation

@esafirm
Copy link
Copy Markdown

@esafirm esafirm commented Nov 26, 2024

Description

Fixes #1044

This PR enables the ContributesSubcomponent.Factory to return the component super type.
The capability of returning component super type is available in @MergeComponent and is also supported in Dagger.

An example of this can be super useful is when we have a base factory.

interface BaseSubcomponent {
  interface Factory {
    fun createFactory(): BaseSubcomponent
  }
}

@ContributesSubcomponent.Factory 
interface Factory : BaseSubcomponent.Factory

This works as expected on 2.5.0-beta09 but later throws a compile error in 2.5.0-beta10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContributesSubcomponent.Factory validation fails when the function is overridden

2 participants