K2: repeat K1 representation for flexible type parameters
This commit changes the behavior of KT-59138 effectively declining it in 2.0. However, we plan to implement KT-59138 behavior under a feature flag in 2.0 (see KT-66447), and switch this feature on version 2.x. Also, this commit implements the LC resolution about postponing KT-57014 change. We don't have KT-57014 described behavior in 2.0 anymore. However, we plan to implement a deprecation warning here, see KT-65578. After this commit, 6 diagnostic tests become incorrectly broken: - 5 tests from PurelyImplementedCollection group - a test platformTypes/nullableTypeArgument.kt This commit also breaks currently fixed-in-k2 KT-50134 (it is fixed again in the following commits), as well as KT-58933 (it will remain not fixed till we enable KT-59138 behavior again). #KT-65596 In Progress #KT-57014 In Progress #KT-58933 Submitted
This commit is contained in:
committed by
Space Team
parent
7fd46f1450
commit
81414d758d
+1
-1
@@ -34,7 +34,7 @@ FILE: Eq.kt
|
||||
public get(): R|lib/a/A<R, S>|
|
||||
|
||||
public open override fun withL(l: R|kotlin/Int|): R|lib/a/C.WithL<R, S>| {
|
||||
^withL Q|lib/a/C|.R|lib/a/C.MyWithL.MyWithL|<R|R|, R|S|>()
|
||||
^withL Q|lib/a/C|.R|lib/a/C.MyWithL.MyWithL|<R|R!|, R|S!|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ fun <R> main(a: ReturnType<R>) {
|
||||
takeNullableStringAndKNullable(x1)
|
||||
takeNotNullStringAndNotNullK(<!ARGUMENT_TYPE_MISMATCH!>x1<!>)
|
||||
takeNullableStringAndNotNullK(<!ARGUMENT_TYPE_MISMATCH!>x1<!>)
|
||||
takeNotNullString(a.foo41.foo411)
|
||||
takeNotNullString(<!ARGUMENT_TYPE_MISMATCH!>a.foo41.foo411<!>)
|
||||
|
||||
val x2 = <!DEBUG_INFO_EXPRESSION_TYPE("ReturnType.A<kotlin.String?, R!!>..ReturnType.A<kotlin.String?, R!!>?!")!>a.foo2()<!>
|
||||
takeNotNullStringAndKNullable(<!ARGUMENT_TYPE_MISMATCH!>x2<!>)
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@ fun <R> main(a: ReturnTypeWithWarnings<R>) {
|
||||
takeNullableStringAndKNullable(x1)
|
||||
takeNotNullStringAndNotNullK(<!ARGUMENT_TYPE_MISMATCH!>x1<!>)
|
||||
takeNullableStringAndNotNullK(<!ARGUMENT_TYPE_MISMATCH!>x1<!>)
|
||||
takeNotNullString(a.foo41.foo411)
|
||||
takeNotNullString(<!ARGUMENT_TYPE_MISMATCH!>a.foo41.foo411<!>)
|
||||
|
||||
val x2 = <!DEBUG_INFO_EXPRESSION_TYPE("ReturnTypeWithWarnings.A<kotlin.String?, R!!>..ReturnTypeWithWarnings.A<kotlin.String?, R!!>?!")!>a.foo2()<!>
|
||||
takeNotNullStringAndKNullable(<!ARGUMENT_TYPE_MISMATCH!>x2<!>)
|
||||
|
||||
+3
-3
@@ -66,10 +66,10 @@ abstract class A<T> : Provider<T> {
|
||||
abstract class B<T> : Provider<T> {
|
||||
override fun get(): T & Any = null!!
|
||||
override fun getNullable(): T? = null!!
|
||||
override fun set(x: T & Any) {} // False positive in K1
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun set(x: T & Any) {} // False positive in K1
|
||||
override fun setNullable(x: T?) {}
|
||||
|
||||
override fun getSet(x: T & Any): T & Any = x // False positive in K1
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun getSet(x: T & Any): T & Any = x // False positive in K1
|
||||
override fun getSetNullable(x: T?): T? = x
|
||||
}
|
||||
|
||||
@@ -79,6 +79,6 @@ abstract class C<T> : Provider<T> {
|
||||
}
|
||||
|
||||
abstract class D<T> : Provider<T> {
|
||||
<!WRONG_NULLABILITY_FOR_JAVA_OVERRIDE!>override<!> fun getSet(x: T & Any): T = x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> // False positive in K1
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun getSet(x: T & Any): T = x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> // False positive in K1
|
||||
override fun getSetNullable(x: T?): T = x!!
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNonNullableTypes +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
|
||||
// FILE: A.java
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public interface A<T> {
|
||||
public T foo(T x) { return x; }
|
||||
@NotNull
|
||||
public T bar(@NotNull T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1 & Any): T1 & Any
|
||||
}
|
||||
|
||||
interface C<T2> : A<T2> {
|
||||
override fun foo(x: T2 & Any): T2 & Any
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||
}
|
||||
|
||||
interface D : A<String?> {
|
||||
override fun foo(x: String?): String?
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface E : A<String> {
|
||||
override fun foo(x: String): String
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface F : A<String?> {
|
||||
override fun foo(x: String): String
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||
}
|
||||
|
||||
interface G<T3 : Any> : A<T3> {
|
||||
override fun foo(x: T3): T3
|
||||
override fun bar(x: T3): T3
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +DefinitelyNonNullableTypes +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
|
||||
// FILE: A.java
|
||||
|
||||
+8
-8
@@ -73,14 +73,14 @@ fun test() {
|
||||
}
|
||||
val ret2 = build {
|
||||
emit(if (true) "" else null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select2(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String..kotlin.String?!")!>select3(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>select2(Test.foo(get()), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select3(get(), getIn())<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select3(get(), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select3(Test.foo(get()), Test.foo(getIn()))<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>select3(Test.foo(get()), getIn())<!>
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ val xExplicit: X = Test().findViewById(0)
|
||||
val xCast = Test().findViewById(0) as X
|
||||
|
||||
val xCastExplicitType = Test().findViewById<X>(0) as X
|
||||
val xSafeCastExplicitType = Test().findViewById<X>(0) <!USELESS_CAST!>as? X<!>
|
||||
val xSafeCastExplicitType = Test().findViewById<X>(0) as? X
|
||||
|
||||
val yExplicit: Y<String> = Test().findViewById(0)
|
||||
val yCast = Test().findViewById(0) as Y<String>
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ fun <K : Builder<K>> testTypeParam(builder: Builder<K>) {
|
||||
}
|
||||
|
||||
fun testStarJava(builder: JavaBuilder<*>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!!..CapturedType(*)?!")!>builder.test()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)..CapturedType(*)?!")!>builder.test()<!>
|
||||
|
||||
builder
|
||||
.test()
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ fun test() {
|
||||
}
|
||||
|
||||
fun testJava(appender: JavaWriterAppender) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!!..CapturedType(*)?!")!>appender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)..CapturedType(*)?!")!>appender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("JavaWriterAppender.Builder1<CapturedType(*)>")!>appender.Builder1()<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!!..CapturedType(*)?!")!>appender.intersectTwoSelfTypes()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)..CapturedType(*)?!")!>appender.intersectTwoSelfTypes()<!>
|
||||
}
|
||||
|
||||
object WriterAppender {
|
||||
|
||||
+6
-6
@@ -7,13 +7,13 @@ B2:
|
||||
[IntersectionOverride]: public open override fun remove(p0: R|@EnhancedNullability kotlin/Int|): R|kotlin/Boolean| from Use site scope of /B2 [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun remove(p0: R|@EnhancedNullability kotlin/Int|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for java/util/ArrayList] for type B2 [id: 1]
|
||||
[Enhancement]: public open fun remove(p0: R|@EnhancedNullability E|): R|kotlin/Boolean| from Java enhancement scope for java/util/ArrayList [id: 2]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun remove(p0: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type java/util/ArrayList<E> [id: 3]
|
||||
[IntersectionOverride]: public open override fun remove(p0: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Java enhancement scope for java/util/AbstractList [id: 4]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun remove(p0: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for java/util/AbstractCollection] for type java/util/AbstractList<E> [id: 5]
|
||||
[Enhancement]: public open fun remove(p0: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Java enhancement scope for java/util/AbstractCollection [id: 6]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type java/util/AbstractCollection<E> [id: 7]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun remove(p0: R|E!|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type java/util/ArrayList<E> [id: 3]
|
||||
[IntersectionOverride]: public open override fun remove(p0: R|E!|): R|kotlin/Boolean| from Java enhancement scope for java/util/AbstractList [id: 4]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun remove(p0: R|E!|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for java/util/AbstractCollection] for type java/util/AbstractList<E> [id: 5]
|
||||
[Enhancement]: public open fun remove(p0: R|E!|): R|kotlin/Boolean| from Java enhancement scope for java/util/AbstractCollection [id: 6]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|E!|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type java/util/AbstractCollection<E> [id: 7]
|
||||
[Library]: public abstract fun remove(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 8]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|ft<E & Any, E?>|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList<E> [id: 9]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|E!|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList<E> [id: 9]
|
||||
[Library]: public abstract fun remove(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableList [id: 10]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type kotlin/collections/MutableList<E> [id: 11]
|
||||
[Library]: public abstract fun remove(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 8]
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// ISSUE: KT-59138
|
||||
// SKIP_TXT
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public static <K> K simpleId(K k) { // fun <K> simpleId(k: K & Any..K?): K & Any..K? =
|
||||
return k;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun takeN(n: Number?): Int = 1
|
||||
|
||||
fun bar(n: Number?) {
|
||||
fun takeN(n: Number): String = ""
|
||||
|
||||
// in K1, it was resolved to nullable takeN
|
||||
// in K2, it would be resolved to not-nullable and may fail with NPE
|
||||
takeN(JavaClass.simpleId(n)).<!UNRESOLVED_REFERENCE!>div<!>(1)
|
||||
takeN(JavaClass.simpleId(n)).length
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-59138
|
||||
// SKIP_TXT
|
||||
// FILE: JavaClass.java
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ A:
|
||||
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/AbstractMutableList [id: 2]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun removeAt(index: R|kotlin/Int|): R|E| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type kotlin/collections/AbstractMutableList<E> [id: 3]
|
||||
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override operator fun removeAt(p0: R|kotlin/Int|): R|ft<E & Any, E?>| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type kotlin/collections/AbstractMutableList<E> [id: 5]
|
||||
[Enhancement]: public open operator fun removeAt(p0: R|kotlin/Int|): R|ft<E & Any, E?>| from Java enhancement scope for java/util/AbstractList [id: 6]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun removeAt(index: R|kotlin/Int|): R|ft<E & Any, E?>| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList<E> [id: 7]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override operator fun removeAt(p0: R|kotlin/Int|): R|E!| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type kotlin/collections/AbstractMutableList<E> [id: 5]
|
||||
[Enhancement]: public open operator fun removeAt(p0: R|kotlin/Int|): R|E!| from Java enhancement scope for java/util/AbstractList [id: 6]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun removeAt(index: R|kotlin/Int|): R|E!| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList<E> [id: 7]
|
||||
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4]
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ D:
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /D [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /C [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /A] for type C [id: 0]
|
||||
[Enhancement]: public open fun foo(x: R|kotlin/Int!|): R|ft<T & Any, T?>| from Java enhancement scope for /A [id: 1]
|
||||
[Enhancement]: public open fun foo(x: R|kotlin/Int!|): R|T!| from Java enhancement scope for /A [id: 1]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /D [id: 0]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /B [id: 0]
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ D:
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /D [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Java enhancement scope for /C [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /A] for type C [id: 0]
|
||||
[Enhancement]: public open fun foo(x: R|ft<T & Any, T?>|): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||
[Enhancement]: public open fun foo(x: R|T!|): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /D [id: 0]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /B [id: 0]
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ D:
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /D [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /C [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /A] for type C [id: 0]
|
||||
[Enhancement]: public open fun foo(x: R|ft<T & Any, T?>|): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||
[Enhancement]: public open fun foo(x: R|T!|): R|kotlin/String!| from Java enhancement scope for /A [id: 1]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /D [id: 0]
|
||||
[Source]: public open fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /B [id: 0]
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ E:
|
||||
[IntersectionOverride]: public? open override fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /E [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Use site scope of /C [id: 1]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int!|): R|kotlin/String!| from Substitution scope for [Java enhancement scope for /A] for type C [id: 1]
|
||||
[Enhancement]: public open fun foo(x: R|ft<T & Any, T?>|): R|kotlin/String!| from Java enhancement scope for /A [id: 2]
|
||||
[Enhancement]: public open fun foo(x: R|T!|): R|kotlin/String!| from Java enhancement scope for /A [id: 2]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int|): R|kotlin/String| from Use site scope of /D [id: 3]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(x: R|kotlin/Int|): R|kotlin/String| from Substitution scope for [Use site scope of /B] for type D [id: 3]
|
||||
[Source]: public open fun foo(x: R|T|): R|kotlin/String| from Use site scope of /B [id: 4]
|
||||
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ fun <V> SLRUMap<V>.getOrPut(value: V, l: List<V>) {
|
||||
|
||||
takeE(<!ARGUMENT_TYPE_MISMATCH!>value<!>)
|
||||
takeEList(<!ARGUMENT_TYPE_MISMATCH!>l<!>)
|
||||
takeE(id(value))
|
||||
takeE(<!ARGUMENT_TYPE_MISMATCH!>id(value)<!>)
|
||||
|
||||
if (value != null) {
|
||||
takeV(value)
|
||||
|
||||
+2
@@ -5,3 +5,5 @@
|
||||
/main.kt:(133,138): error: Argument type mismatch: actual type is 'V', but 'E & Any' was expected.
|
||||
|
||||
/main.kt:(154,155): error: Argument type mismatch: actual type is 'kotlin.collections.List<V>', but 'kotlin.collections.(Mutable)List<@NotNull() E & Any>' was expected.
|
||||
|
||||
/main.kt:(167,176): error: Argument type mismatch: actual type is 'V!', but 'E & Any' was expected.
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ fun <V> SLRUMap<V>.getOrPut(value: V, l: List<V>) {
|
||||
|
||||
takeE(<!ARGUMENT_TYPE_MISMATCH!>value<!>)
|
||||
takeEList(<!ARGUMENT_TYPE_MISMATCH!>l<!>)
|
||||
takeE(id(value))
|
||||
takeE(<!ARGUMENT_TYPE_MISMATCH!>id(value)<!>)
|
||||
|
||||
if (value != null) {
|
||||
takeV(value)
|
||||
|
||||
+2
-2
@@ -31,12 +31,12 @@ public class Foo<T> {
|
||||
|
||||
// FILE: main.kt
|
||||
fun <T> bar(n: Number?, d: T, e: T) {
|
||||
val a: Number = Foo.simpleId(n)
|
||||
val a: Number = <!INITIALIZER_TYPE_MISMATCH!>Foo.simpleId(n)<!>
|
||||
val b: Number? = Foo.simpleId(n)
|
||||
val c = Foo.simpleId(n)
|
||||
|
||||
val x4 = Foo(if (true) 10 else null)
|
||||
val x5: Number = x4.produceT()
|
||||
val x5: Number = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>x4.produceT()<!>
|
||||
val x6: Number? = x4.produceT()
|
||||
val x7 = x4.produceT()
|
||||
val x8 = x4.produceNotNullT()
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// ISSUE: KT-58933
|
||||
// FILE: J.java
|
||||
public interface J<T> {
|
||||
void simple(T t);
|
||||
void box(Box<T> box);
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
class Box<T>
|
||||
|
||||
class K<T> : J<T> {
|
||||
override fun simple(t: T & Any) {}
|
||||
override fun box(box: Box<T & Any>) {}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-58933
|
||||
// FILE: J.java
|
||||
public interface J<T> {
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ interface Foo
|
||||
|
||||
fun test() {
|
||||
var nullable: Foo? = null
|
||||
val foo: Collection<Foo> = java.util.Collections.singleton(nullable)
|
||||
val foo: Collection<Foo> = <!INITIALIZER_TYPE_MISMATCH!>java.util.Collections.singleton(nullable)<!>
|
||||
val foo1: Collection<Foo> = java.util.Collections.singleton(nullable!!)
|
||||
}
|
||||
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
// ISSUE: KT-57014
|
||||
// FULL_JDK
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
import java.util.function.Supplier
|
||||
|
||||
fun main() {
|
||||
val sam = Supplier<String> {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>foo()<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(): String? = null
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57014
|
||||
// FULL_JDK
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ FILE: test2.kt
|
||||
}
|
||||
FILE: test3.kt
|
||||
public final fun test3(): R|ft<kotlin/collections/MutableMap<kotlin/String!, kotlin/String!>, kotlin/collections/Map<kotlin/String!, kotlin/String!>?>| {
|
||||
^test3 Q|java/util/Map|.R|java/util/Map.of*s|<R|kotlin/String|, R|kotlin/String|>()
|
||||
^test3 Q|java/util/Map|.R|java/util/Map.of*s|<R|kotlin/String!|, R|kotlin/String!|>()
|
||||
}
|
||||
FILE: test4.kt
|
||||
public final fun test4(): R|kotlin/Int| {
|
||||
|
||||
Reference in New Issue
Block a user