Fix builder inference tests

This commit is contained in:
Victor Petukhov
2021-05-26 17:54:28 +03:00
parent 4a767c597e
commit bd7fb56a24
25 changed files with 78 additions and 124 deletions
@@ -1,6 +1,7 @@
// !LANGUAGE: +UnrestrictedBuilderInference
// WITH_RUNTIME
// DONT_TARGET_EXACT_BACKEND: WASM
// TARGET_BACKEND: JVM
// FILE: Test.java
@@ -2,6 +2,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
// WITH_RUNTIME
// DONT_TARGET_EXACT_BACKEND: WASM
// TARGET_BACKEND: JVM
// FILE: Test.java
@@ -1,6 +1,7 @@
// IGNORE_BACKEND_FIR: JVM_IR
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: WASM
import kotlin.experimental.ExperimentalTypeInference
@@ -36,7 +36,7 @@ fun <R> main(a: ReturnType<R>) {
takeNotNullStringAndKNullable(<!TYPE_MISMATCH!>x1<!>)
takeNullableStringAndKNullable(x1)
takeNotNullStringAndNotNullK(<!TYPE_MISMATCH("ReturnType.A<String, TypeVariable(K)>; ReturnType.A<String?, R?>!")!>x1<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x1<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH!>x1<!>)
takeNotNullString(<!TYPE_MISMATCH!>a.foo41.foo411<!>)
val x2 = <!DEBUG_INFO_EXPRESSION_TYPE("(ReturnType.A<@org.jetbrains.annotations.Nullable kotlin.String?, @org.jetbrains.annotations.NotNull R!!>..ReturnType.A<@org.jetbrains.annotations.Nullable kotlin.String?, @org.jetbrains.annotations.NotNull R!!>?)")!>a.foo2()<!>
@@ -60,6 +60,6 @@ fun <R> main(a: ReturnType<R>) {
val x5 = <!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Array<@org.jetbrains.annotations.Nullable kotlin.String?>..kotlin.Array<out @org.jetbrains.annotations.Nullable kotlin.String?>?)")!>a.foo5()<!>
takeArrayOfNotNullString(<!TYPE_MISMATCH!>x5<!>)
takeArrayOfNullableString(x5)
takeArrayOfNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x5<!>)
takeArrayOfNotNullK(<!TYPE_MISMATCH!>x5<!>)
takeArrayOfNullableK(x5)
}
@@ -37,26 +37,26 @@ fun <R> main(a: ReturnTypeWithWarnings<R>) {
val x1 = <!DEBUG_INFO_EXPRESSION_TYPE("(ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?), (@org.jetbrains.annotations.Nullable R..@org.jetbrains.annotations.Nullable R?)>..ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?), (@org.jetbrains.annotations.Nullable R..@org.jetbrains.annotations.Nullable R?)>?)")!>a.foo1()<!>
takeNotNullStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>; ReturnTypeWithWarnings.A<String?, R?>!")!>x1<!>)
takeNullableStringAndKNullable(x1)
takeNotNullStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>; ReturnTypeWithWarnings.A<String?, R?>!"), TYPE_MISMATCH("Any; R!"), TYPE_MISMATCH("Any; R!")!>x1<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x1<!>)
takeNotNullString(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("String; String?")!>a.foo41.foo411<!>)
takeNotNullStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>", "ReturnTypeWithWarnings.A<String?, R?>!"), TYPE_MISMATCH("Any", "R!")!>x1<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH!>x1<!>)
takeNotNullString(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("String", "String?")!>a.foo41.foo411<!>)
val x2 = <!DEBUG_INFO_EXPRESSION_TYPE("(ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?), (@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>..ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?), (@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>?)")!>a.foo2()<!>
takeNotNullStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>; ReturnTypeWithWarnings.A<String?, R!!>!")!>x2<!>)
takeNullableStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R?>; ReturnTypeWithWarnings.A<String?, R!!>!")!>x2<!>)
takeNotNullStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R!!>; ReturnTypeWithWarnings.A<String?, R!!>!"), TYPE_MISMATCH("Any; R!"), TYPE_MISMATCH("Any; R!")!>x2<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x2<!>)
takeNotNullStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>", "ReturnTypeWithWarnings.A<String?, R!!>!")!>x2<!>)
takeNullableStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R?>", "ReturnTypeWithWarnings.A<String?, R!!>!")!>x2<!>)
takeNotNullStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R!!>", "ReturnTypeWithWarnings.A<String?, R!!>!"), TYPE_MISMATCH("Any", "R!")!>x2<!>)
takeNullableStringAndNotNullK(<!TYPE_MISMATCH!>x2<!>)
val x3 = <!DEBUG_INFO_EXPRESSION_TYPE("(ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.NotNull kotlin.String..@org.jetbrains.annotations.NotNull kotlin.String?), (@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>..ReturnTypeWithWarnings.A<(@org.jetbrains.annotations.NotNull kotlin.String..@org.jetbrains.annotations.NotNull kotlin.String?), (@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>?)")!>a.foo3<!>
takeNotNullStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>; ReturnTypeWithWarnings.A<String, R!!>!")!>x3<!>)
takeNullableStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R?>; ReturnTypeWithWarnings.A<String, R!!>!")!>x3<!>)
takeNotNullStringAndNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x3<!>)
takeNullableStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R!!>; ReturnTypeWithWarnings.A<String, R!!>!"), TYPE_MISMATCH("Any; R!"), TYPE_MISMATCH("Any; R!")!>x3<!>)
takeNotNullStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String, R?>", "ReturnTypeWithWarnings.A<String, R!!>!")!>x3<!>)
takeNullableStringAndKNullable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R?>", "ReturnTypeWithWarnings.A<String, R!!>!")!>x3<!>)
takeNotNullStringAndNotNullK(<!TYPE_MISMATCH!>x3<!>)
takeNullableStringAndNotNullK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("ReturnTypeWithWarnings.A<String?, R!!>", "ReturnTypeWithWarnings.A<String, R!!>!"), TYPE_MISMATCH("Any", "R!")!>x3<!>)
val x4 = <!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Array<(@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>..kotlin.Array<out (@org.jetbrains.annotations.NotNull R..@org.jetbrains.annotations.NotNull R?)>)")!>a.foo4<!>
takeArrayOfNotNullString(<!TYPE_MISMATCH!>x4<!>)
takeArrayOfNullableString(<!TYPE_MISMATCH!>x4<!>)
takeArrayOfNotNullK(<!TYPE_MISMATCH, TYPE_MISMATCH!>x4<!>)
takeArrayOfNotNullK(<!TYPE_MISMATCH!>x4<!>)
takeArrayOfNullableK(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS("Array<R?>; Array<(out) R!!>")!>x4<!>)
val x5 = <!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Array<(@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?)>?..kotlin.Array<out (@org.jetbrains.annotations.Nullable kotlin.String..@org.jetbrains.annotations.Nullable kotlin.String?)>?)")!>a.foo5()<!>
@@ -72,7 +72,7 @@ fun poll14(flag: Boolean): Flow<String> {
fun poll15(flag: Boolean): Flow<String> {
return flow {
val inv = if (flag) { ::bar5 } else { ::foo5 }
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -93,7 +93,7 @@ fun poll17(flag: Boolean): Flow<String> {
fun poll4(): Flow<String> {
return flow {
val inv = try { ::bar } finally { ::foo }
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -121,7 +121,7 @@ fun poll43(): Flow<String> {
fun poll44(): Flow<String> {
return flow {
val inv = try { ::bar5 } finally { ::foo5 }
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -142,7 +142,7 @@ fun poll46(): Flow<String> {
fun poll5(): Flow<String> {
return flow {
val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo }
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -170,7 +170,7 @@ fun poll53(): Flow<String> {
fun poll54(): Flow<String> {
return flow {
val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 }
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -38,7 +38,7 @@ class Flow<out R>(private val block: suspend FlowCollector<R>.() -> Unit)
fun poll7(): Flow<String> {
return flow {
val inv = ::bar<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
inv(<!NO_VALUE_FOR_PARAMETER{LT}!>)<!>
inv()
}
}
@@ -24,7 +24,7 @@ fun test() {
get()?.test2()
get().test2()
get()?.hashCode()
get()?.equals(1)
get()?.<!NONE_APPLICABLE!>equals<!>(1)
// there is `String?.equals` extension
get().equals("")
}
@@ -35,10 +35,10 @@ fun test() {
get()?.test2()
get().test2()
get()?.hashCode()
get()?.equals(1)
get()?.<!NONE_APPLICABLE!>equals<!>(1)
val x = get()
x?.hashCode()
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
x.equals("")
}
val ret3 = build {
@@ -48,22 +48,22 @@ fun test() {
get()?.test2()
get().test2()
get()?.hashCode()
get()?.equals(1)
get()?.<!NONE_APPLICABLE!>equals<!>(1)
val x = get()
x?.hashCode()
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (x != null) {
x?.hashCode()
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
x.equals("")
x.hashCode()
x.toString()
x.test()
x?.test2()
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
x.test2()
}
@@ -94,7 +94,7 @@ fun test() {
emit(null)
val x = get()
if (x == null) {
x.toString("")
x.<!NONE_APPLICABLE!>toString<!>("")
}
""
@@ -134,7 +134,7 @@ fun test() {
emit(null)
val x = get()
if (x === null) {
x.toString("")
x.<!NONE_APPLICABLE!>toString<!>("")
}
""
@@ -164,24 +164,24 @@ fun test() {
get()?.test2()
get().test2()
get()?.hashCode()
get()?.equals(1)
get()?.<!NONE_APPLICABLE!>equals<!>(1)
val x = get()
x?.hashCode()
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (x == null) {
x?.hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
}
if (x == null) {
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
}
if (x == null) {
x?.test2()
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
}
if (x == null) {
@@ -189,15 +189,15 @@ fun test() {
}
if (x === null) {
x?.hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
}
if (x === null) {
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
}
if (x === null) {
x?.test2()
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
}
if (x === null) {
@@ -294,21 +294,21 @@ fun test() {
get()?.test2()
get().test2()
get()?.hashCode()
get()?.equals(1)
get()?.<!NONE_APPLICABLE!>equals<!>(1)
val x = get()
x?.hashCode()
x?.equals(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (x == null) {
x?.hashCode()
x?.equals(1)
x?.test2()
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
x.test2()
}
""
}
}
}
@@ -20,8 +20,8 @@ suspend fun yield() {}
fun test() {
builder {
send(<!ARGUMENT_TYPE_MISMATCH{LT}!>run {
send(run {
yield() // No error but `yield` is not inside "suspension" context actually
}<!>)
})
}
}
@@ -84,10 +84,10 @@ fun test() {
with(this) {
yield("")
this@with.<!UNRESOLVED_REFERENCE{LT}!>yield<!>("")
this@with.yield("")
yield2("")
this@with.<!INAPPLICABLE_CANDIDATE{LT}!>yield2<!>("")
this@with.yield2("")
}
}
}
@@ -14513,6 +14513,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BuilderInference extends AbstractLightAnalysisModeTest {
@TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt")
public void ignoreSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -14611,11 +14616,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt");
}
@TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt")
public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt");
}
@TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt")
public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt");
@@ -84,9 +84,9 @@ fun case3() {
try {
throwExceptionA(false)
A(2)
} catch (e: ExcA) <!TYPE_MISMATCH, TYPE_MISMATCH!>{
} catch (e: ExcA) <!TYPE_MISMATCH!>{
A(<!NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
}<!> catch (e: ExcB) <!TYPE_MISMATCH, TYPE_MISMATCH!>{
}<!> catch (e: ExcB) <!TYPE_MISMATCH!>{
B(<!NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
}<!>
}
@@ -28,8 +28,8 @@ fun C?.boo( c: ()->C) : String { //(2)
this.<!DEBUG_INFO_CALL("fqName: testPackCase1.boo; typeCall: extension function")!>boo( x )<!>// ok to (1)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>this.boo( x )<!>
this.<!DEBUG_INFO_CALL("fqName: testPackCase1.boo; typeCall: extension function")!>boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!> //to (2); {1} is ()->C
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this.boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!>
this.<!DEBUG_INFO_CALL("fqName: testPackCase1.boo; typeCall: extension function")!>boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!> //to (2); {1} is ()->C
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this.boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!>
return ""
}
@@ -49,8 +49,8 @@ fun C?.boo( c: ()->C, x : Int = 1) : String { //(2)
this.<!DEBUG_INFO_CALL("fqName: testPackCase2.boo; typeCall: extension function")!>boo( x )<!>// ok to (1)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>this.boo( x )<!>
this.<!DEBUG_INFO_CALL("fqName: testPackCase2.boo; typeCall: extension function")!>boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!> //to (2); {1} is ()->C
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this.boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!>
this.<!DEBUG_INFO_CALL("fqName: testPackCase2.boo; typeCall: extension function")!>boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!> //to (2); {1} is ()->C
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this.boo( {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>})<!>
return ""
}
@@ -29,8 +29,8 @@ inline operator fun B?.plusAssign( c: ()->Any) { } //(1)
@JvmName("aa")
inline operator fun B?.plusAssign( c: ()->C) { //(2)
this <!RECURSION_IN_INLINE!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}
<!DEBUG_INFO_CALL("fqName: testPackCase1.plusAssign; typeCall: inline operator extension function")!>this <!RECURSION_IN_INLINE!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
this <!RECURSION_IN_INLINE!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}
<!DEBUG_INFO_CALL("fqName: testPackCase1.plusAssign; typeCall: inline operator extension function")!>this <!RECURSION_IN_INLINE!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
}
class C
@@ -28,7 +28,7 @@ fun case1 (){
var b: B? = B()
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> { C() }<!>
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
}
class B {
@@ -65,7 +65,7 @@ fun case2 (){
var b: B = B()
<!DEBUG_INFO_CALL("fqName: testPackCase2.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b += { C() }<!>
<!DEBUG_INFO_CALL("fqName: testPackCase2.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b += {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
<!DEBUG_INFO_CALL("fqName: testPackCase2.B.plus; typeCall: operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b += {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
}
class B {
@@ -23,7 +23,7 @@ fun case1 (){
var b: B? = null
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: inline operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> { C() }<!>
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: inline operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
<!DEBUG_INFO_CALL("fqName: testPackCase1.B.plus; typeCall: inline operator function"), INVISIBLE_MEMBER, TYPE_MISMATCH!>b <!UNSAFE_OPERATOR_CALL!>+=<!> {<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}<!>
}
class B {
@@ -24,7 +24,7 @@ import LibPackCase1.a.plusAssign
fun case1 (){
var b: B = B()
b +={ <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>C()<!> }
b +={ <!TYPE_MISMATCH, TYPE_MISMATCH!>C()<!> }
b +={ 1 }
}
@@ -23,7 +23,7 @@ import LibPackCase1.a.boo
import LibPackCase1.b.*
fun case1 (b: B?){
b.boo({ <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>C()<!> })
b.boo({ <!TYPE_MISMATCH, TYPE_MISMATCH!>C()<!> })
b.boo({1})
}
@@ -44,7 +44,7 @@ fun case_1() {
fun case_2(): Int {
fun b(): Int {
var c: Int? = null
if (c == null || 0 < <!SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>c<!>) c = 0
if (c == null || 0 < <!SMARTCAST_IMPOSSIBLE!>c<!>) c = 0
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>c<!>
return c ?: 0
}
@@ -12735,16 +12735,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt");
}
@TestMetadata("commonSuperTypeContravariant.kt")
public void testCommonSuperTypeContravariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeContravariant.kt");
}
@TestMetadata("commonSuperTypeInvariant.kt")
public void testCommonSuperTypeInvariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeInvariant.kt");
}
@TestMetadata("kt41164.kt")
public void testKt41164() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
@@ -12800,11 +12790,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt");
}
@TestMetadata("specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt")
public void testSpecialCallsWithCallableReferencesNonStrictOnlyInputTypes() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt");
}
@TestMetadata("specialCallsWithLambdas.kt")
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt");
@@ -12141,16 +12141,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt");
}
@TestMetadata("commonSuperTypeContravariant.kt")
public void testCommonSuperTypeContravariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeContravariant.kt");
}
@TestMetadata("commonSuperTypeInvariant.kt")
public void testCommonSuperTypeInvariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeInvariant.kt");
}
@TestMetadata("kt41164.kt")
public void testKt41164() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
@@ -12206,11 +12196,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt");
}
@TestMetadata("specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt")
public void testSpecialCallsWithCallableReferencesNonStrictOnlyInputTypes() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt");
}
@TestMetadata("specialCallsWithLambdas.kt")
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt");
@@ -12206,16 +12206,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt");
}
@TestMetadata("commonSuperTypeContravariant.kt")
public void testCommonSuperTypeContravariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeContravariant.kt");
}
@TestMetadata("commonSuperTypeInvariant.kt")
public void testCommonSuperTypeInvariant() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperTypeInvariant.kt");
}
@TestMetadata("kt41164.kt")
public void testKt41164() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
@@ -12271,11 +12261,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt");
}
@TestMetadata("specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt")
public void testSpecialCallsWithCallableReferencesNonStrictOnlyInputTypes() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt");
}
@TestMetadata("specialCallsWithLambdas.kt")
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt");
-4
View File
@@ -1,9 +1,5 @@
// ERROR: Type mismatch: inferred type is Any! but String? was expected
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String? was expected
// ERROR: Type mismatch: inferred type is Any! but String? was expected
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String? was expected
// ERROR: Type mismatch: inferred type is Any! but String? was expected
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String? was expected
// ERROR: Type mismatch: inferred type is HashMap<Any?, Any?> but Map<String?, String?> was expected
import java.util.HashMap
import java.util.Properties
@@ -7,9 +7,9 @@ UFile (package = ) [public final class InnerNonFixedTypeVariableKt {...]
UQualifiedReferenceExpression [list.filterIsInstance().<anonymous class>(mutableSetOf(), { ...})] : PsiType:<ErrorType>
UQualifiedReferenceExpression [list.filterIsInstance()]
USimpleNameReferenceExpression (identifier = list) [list] : PsiType:List<? extends Object>
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [filterIsInstance()] : PsiType:List<? extends NonExistentClass>
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [filterIsInstance()]
UIdentifier (Identifier (filterIsInstance)) [UIdentifier (Identifier (filterIsInstance))]
USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) [filterIsInstance] : PsiType:List<? extends NonExistentClass>
USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) [filterIsInstance]
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [<anonymous class>(mutableSetOf(), { ...})] : PsiType:<ErrorType>
UIdentifier (Identifier (mapTo)) [UIdentifier (Identifier (mapTo))]
USimpleNameReferenceExpression (identifier = <anonymous class>, resolvesTo = null) [<anonymous class>] : PsiType:<ErrorType>
@@ -340,7 +340,7 @@ class KotlinUastResolveApiTest : KotlinLightCodeInsightFixtureTestCase() {
val uFile = myFixture.file.toUElement()!!
TestCase.assertEquals(
"PsiType:void",
"PsiType:List<?>",
uFile.findElementByTextFromPsi<UExpression>("arr[0]").getExpressionType().toString()
)
TestCase.assertEquals(