File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed
main/kotlin/org/jetbrains/kotlinx/dataframe/impl
test/kotlin/org/jetbrains/kotlinx/dataframe/types
main/kotlin/org/jetbrains/kotlinx/dataframe/impl
test/kotlin/org/jetbrains/kotlinx/dataframe/types Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ internal fun KType.replaceGenericTypeParametersWithUpperbound(): KType {
7474 (oldType.classifier as KTypeParameter ).upperBounds.firstOrNull() ? : typeOf<Any ?>()
7575
7676 // Type<in T> cannot be replaced with Type<Any?>, instead it should be replaced with Type<Nothing>
77+ // TODO: issue #471
7778 IN -> nothingType(false )
7879 }
7980 }
Original file line number Diff line number Diff line change @@ -168,14 +168,18 @@ class UtilTests {
168168 interface TypeWithUpperbound1 <T : UpperBound >
169169 interface TestType1 <T : UpperBound > : TypeWithUpperbound1 <T >
170170 interface TestTypeIn1 <in T > : Comparable <T >
171+ interface TestType2 <S : UpperBound > : TestTypeIn1 <TestType1 <S >>
171172
172173 @Test
173- fun eraseGenericTypeParameters () {
174+ fun replaceGenericTypeParametersWithUpperbound () {
174175 val typeWithUpperboundT = TestType1 ::class .supertypes.first() // TypeWithUpperbound<T>
175176 typeWithUpperboundT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<TypeWithUpperbound1 <UpperBound >>()
176177
177178 val comparableTypeT = TestTypeIn1 ::class .supertypes.first() // Comparable<T>
178179 comparableTypeT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<Comparable <Nothing >>()
180+
181+ val nestedTypeWithUpperboundT = TestType2 ::class .supertypes.first() // TestTypeIn1<TestType1<S>>
182+ nestedTypeWithUpperboundT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<TestTypeIn1 <TestType1 <UpperBound >>>()
179183 }
180184
181185 interface AbstractType <T >
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ internal fun KType.replaceGenericTypeParametersWithUpperbound(): KType {
7474 (oldType.classifier as KTypeParameter ).upperBounds.firstOrNull() ? : typeOf<Any ?>()
7575
7676 // Type<in T> cannot be replaced with Type<Any?>, instead it should be replaced with Type<Nothing>
77+ // TODO: issue #471
7778 IN -> nothingType(false )
7879 }
7980 }
Original file line number Diff line number Diff line change @@ -168,14 +168,18 @@ class UtilTests {
168168 interface TypeWithUpperbound1 <T : UpperBound >
169169 interface TestType1 <T : UpperBound > : TypeWithUpperbound1 <T >
170170 interface TestTypeIn1 <in T > : Comparable <T >
171+ interface TestType2 <S : UpperBound > : TestTypeIn1 <TestType1 <S >>
171172
172173 @Test
173- fun eraseGenericTypeParameters () {
174+ fun replaceGenericTypeParametersWithUpperbound () {
174175 val typeWithUpperboundT = TestType1 ::class .supertypes.first() // TypeWithUpperbound<T>
175176 typeWithUpperboundT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<TypeWithUpperbound1 <UpperBound >>()
176177
177178 val comparableTypeT = TestTypeIn1 ::class .supertypes.first() // Comparable<T>
178179 comparableTypeT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<Comparable <Nothing >>()
180+
181+ val nestedTypeWithUpperboundT = TestType2 ::class .supertypes.first() // TestTypeIn1<TestType1<S>>
182+ nestedTypeWithUpperboundT.replaceGenericTypeParametersWithUpperbound() shouldBe typeOf<TestTypeIn1 <TestType1 <UpperBound >>>()
179183 }
180184
181185 interface AbstractType <T >
You can’t perform that action at this time.
0 commit comments