Skip to content

Commit 1ada636

Browse files
PaulWoitaschekevant
authored andcommitted
Add a test case for overwriting provides functions.
This test case is currently failing. It currently leads to a stack overflow at runtime due to this code (example) being generated: ```kotlin public class InjectInterfaceComponentWithIdenticalProvides( foo: Foo ) : InterfaceComponentWithIdenticalProvides(foo) { public override val foo: Foo get() = foo } ```
1 parent 2220981 commit 1ada636

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

integration-tests/common/src/test/kotlin/me/tatarka/inject/test/InheritanceTest.kt

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ interface ComponentInterface {
1212
val foo: Foo
1313
}
1414

15+
@Component
16+
abstract class InterfaceComponentWithIdenticalProvides(
17+
@get:Provides
18+
override val foo: Foo,
19+
) : ComponentInterface
20+
1521
@Component
1622
abstract class InterfaceComponent : ComponentInterface
1723

@@ -52,6 +58,13 @@ class InheritanceTest {
5258
assertThat(component.foo).isNotNull()
5359
}
5460

61+
@Test
62+
fun test() {
63+
val component = InterfaceComponentWithIdenticalProvides::class.create(Foo())
64+
65+
assertThat(component.foo).isNotNull()
66+
}
67+
5568
@Test
5669
fun generates_a_component_that_provides_a_dep_defined_in_a_generic_implemented_interface() {
5770
val component = GenericInterfaceComponent::class.create()

0 commit comments

Comments
 (0)