File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
core/graph/impl/src/main/kotlin/bindings
testing/tests/src/test/kotlin Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,12 @@ internal class AliasBindingImpl(
41
41
42
42
override fun equals (other : Any? ): Boolean {
43
43
return this == = other || (other is AliasBinding &&
44
- source == other.source && target == other.target &&
45
- owner == other.owner)
44
+ source == other.source && target == other.target)
46
45
}
47
46
48
47
override fun hashCode (): Int {
49
48
var result = target.hashCode()
50
49
result = 31 * result + source.hashCode()
51
- result = 31 * result + owner.hashCode()
52
50
return result
53
51
}
54
52
Original file line number Diff line number Diff line change @@ -1041,5 +1041,33 @@ class CoreBindingsTest(
1041
1041
1042
1042
compileRunAndValidate()
1043
1043
}
1044
+
1045
+ @Test
1046
+ fun `@Binds alias is allowed to be duplicated` () {
1047
+ givenKotlinSource(" test.TestCase" , """
1048
+ import com.yandex.yatagan.*
1049
+ import javax.inject.*
1050
+
1051
+ class TestClass @Inject constructor()
1052
+
1053
+ @Module interface MyModule {
1054
+ @Binds fun binds(i: TestClass): Any
1055
+ @Binds fun binds2(i: TestClass): Any
1056
+ }
1057
+
1058
+ @Component(modules = [MyModule::class])
1059
+ interface TestComponent {
1060
+ val obj: Any
1061
+ fun createSub(): SubComponent
1062
+ }
1063
+
1064
+ @Component(isRoot = false, modules = [MyModule::class])
1065
+ interface SubComponent {
1066
+ val obj: Any
1067
+ }
1068
+ """ .trimIndent())
1069
+
1070
+ compileRunAndValidate()
1071
+ }
1044
1072
}
1045
1073
You can’t perform that action at this time.
0 commit comments