[FE] Support intersection type emptiness checking for interfaces
This commit is contained in:
committed by
teamcity
parent
1da52ab197
commit
39d13442be
+36
@@ -15343,12 +15343,48 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_28.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_29.kt")
|
||||
public void testKt45461_29() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_29.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_3.kt")
|
||||
public void testKt45461_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_30.kt")
|
||||
public void testKt45461_30() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_30.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_31.kt")
|
||||
public void testKt45461_31() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_31.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_32.kt")
|
||||
public void testKt45461_32() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_32.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_33.kt")
|
||||
public void testKt45461_33() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_33.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_34.kt")
|
||||
public void testKt45461_34() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_4.kt")
|
||||
public void testKt45461_4() throws Exception {
|
||||
|
||||
+36
@@ -15343,12 +15343,48 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_28.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_29.kt")
|
||||
public void testKt45461_29() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_29.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_3.kt")
|
||||
public void testKt45461_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_30.kt")
|
||||
public void testKt45461_30() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_30.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_31.kt")
|
||||
public void testKt45461_31() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_31.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_32.kt")
|
||||
public void testKt45461_32() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_32.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_33.kt")
|
||||
public void testKt45461_33() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_33.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_34.kt")
|
||||
public void testKt45461_34() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_4.kt")
|
||||
public void testKt45461_4() throws Exception {
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
import org.jetbrains.kotlin.types.AbstractTypeRefiner
|
||||
import org.jetbrains.kotlin.types.TypeCheckerState
|
||||
@@ -502,8 +503,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
this
|
||||
else {
|
||||
var functionalSupertype: KotlinTypeMarker? = null
|
||||
simpleType.anySuperTypeConstructor { typeConstructor ->
|
||||
simpleType.fastCorrespondingSupertypes(typeConstructor)?.any { superType ->
|
||||
simpleType.anySuperTypeConstructor { type ->
|
||||
simpleType.fastCorrespondingSupertypes(type.typeConstructor())?.any { superType ->
|
||||
val isFunctional = superType.cast<ConeKotlinType>().isBuiltinFunctionalType(session)
|
||||
if (isFunctional)
|
||||
functionalSupertype = superType
|
||||
|
||||
@@ -631,7 +631,8 @@ internal fun captureFromTypeParameterUpperBoundIfNeeded(
|
||||
private fun ConeKotlinType.hasSupertypeWithGivenClassId(classId: ClassId, context: TypeSystemCommonSuperTypesContext): Boolean {
|
||||
return with(context) {
|
||||
anySuperTypeConstructor {
|
||||
it is ConeClassLikeLookupTag && it.classId == classId
|
||||
val typeConstructor = it.typeConstructor()
|
||||
typeConstructor is ConeClassLikeLookupTag && typeConstructor.classId == classId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -38,10 +38,10 @@ fun test() {
|
||||
|
||||
build2 {
|
||||
emit(1)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>intersect<!>(this@build.getIn(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>intersect<!>(getIn(), Test.foo(this@build.getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>intersect<!>(Test.foo(this@build.getIn()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>intersect<!>(Test.foo(getIn()), this@build.getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>intersect(<!TYPE_MISMATCH!>this@build.getIn()<!>, getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>intersect(<!TYPE_MISMATCH!>getIn()<!>, Test.foo(this@build.getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>intersect(<!TYPE_MISMATCH!>Test.foo(this@build.getIn())<!>, Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>intersect(<!TYPE_MISMATCH!>Test.foo(getIn())<!>, this@build.getIn())<!>
|
||||
""
|
||||
}
|
||||
""
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Inv<P>
|
||||
|
||||
interface A
|
||||
interface B
|
||||
|
||||
fun <K : Inv<A>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Inv<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Inv<P>
|
||||
|
||||
interface A
|
||||
interface B
|
||||
|
||||
fun <K : Inv<A>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Inv<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Inv<A>> main(): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv</*0*/ P> {
|
||||
public constructor Inv</*0*/ P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B<K> : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B<String>>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B<K> : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B<String>>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Out<A<kotlin.String>>> main(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ K> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B</*0*/ K> : A<kotlin.Int> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out P> {
|
||||
public constructor Out</*0*/ out P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Out<A<kotlin.String>>> main(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ K> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B : A<kotlin.Int> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out P> {
|
||||
public constructor Out</*0*/ out P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B : A<Int>
|
||||
interface C : A<String>
|
||||
|
||||
fun <K : Out<C>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
interface B : A<Int>
|
||||
interface C : A<String>
|
||||
|
||||
fun <K : Out<C>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Out<C>> main(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ K> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B : A<kotlin.Int> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface C : A<kotlin.String> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out P> {
|
||||
public constructor Out</*0*/ out P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
class B : A<Int>
|
||||
class C : A<String>
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>Out<C><!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
class B : A<Int>
|
||||
class C : A<String>
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>Out<C><!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Out<C>> main(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ K> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A<kotlin.Int> {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C : A<kotlin.String> {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out P> {
|
||||
public constructor Out</*0*/ out P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
class B : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
class Out<out P>
|
||||
|
||||
interface A<K>
|
||||
class B : A<Int>
|
||||
|
||||
fun <K : Out<A<String>>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<Out<B>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : Out<A<kotlin.String>>> main(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ K> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A<kotlin.Int> {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out P> {
|
||||
public constructor Out</*0*/ out P>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
interface A<T>
|
||||
interface B<T> : A<T>
|
||||
|
||||
fun <T : Comparable<T>, S : T?> B<in S>.foo(t: T) {}
|
||||
fun <T : Comparable<T>, S : T?> A<in S>.foo(other: A<in S>) {}
|
||||
|
||||
interface C<T> : B<T>, Comparable<C<*>>
|
||||
|
||||
fun test(x: C<Long?>) {
|
||||
x.foo(x) // OVERLOAD_RESOLUTION_AMBIGUITY, shoub be OK
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface A<T>
|
||||
interface B<T> : A<T>
|
||||
|
||||
@@ -7,5 +8,5 @@ fun <T : Comparable<T>, S : T?> A<in S>.foo(other: A<in S>) {}
|
||||
interface C<T> : B<T>, Comparable<C<*>>
|
||||
|
||||
fun test(x: C<Long?>) {
|
||||
x.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>(x) // OVERLOAD_RESOLUTION_AMBIGUITY, shoub be OK
|
||||
x.foo(x) // OVERLOAD_RESOLUTION_AMBIGUITY, shoub be OK
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,5 +53,5 @@ fun main() {
|
||||
|
||||
select(id(::foo5), id { x: A -> }, id { x: B -> }, id { <!DEBUG_INFO_EXPRESSION_TYPE("C")!>it<!> })
|
||||
|
||||
val x2: (Int) -> Unit = selectNumber(id(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction1<kotlin.Number, kotlin.Unit>")!>::foo6<!>), id { x -> <!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>x<!> }, id { <!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>it<!> })
|
||||
val x2: (Int) -> Unit = selectNumber(id(::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>foo6<!>), id { x -> <!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>x<!> }, id { <!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>it<!> })
|
||||
}
|
||||
|
||||
Generated
+36
@@ -15349,12 +15349,48 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_28.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_29.kt")
|
||||
public void testKt45461_29() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_29.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_3.kt")
|
||||
public void testKt45461_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_30.kt")
|
||||
public void testKt45461_30() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_30.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_31.kt")
|
||||
public void testKt45461_31() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_31.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_32.kt")
|
||||
public void testKt45461_32() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_32.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_33.kt")
|
||||
public void testKt45461_33() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_33.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_34.kt")
|
||||
public void testKt45461_34() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_4.kt")
|
||||
public void testKt45461_4() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user