diff --git a/compiler/testData/codegen/box/inference/builderInference/callableReferencesProperCompletion.kt b/compiler/testData/codegen/box/inference/builderInference/callableReferencesProperCompletion.kt index 4a5209759e5..bd3f86da55d 100644 --- a/compiler/testData/codegen/box/inference/builderInference/callableReferencesProperCompletion.kt +++ b/compiler/testData/codegen/box/inference/builderInference/callableReferencesProperCompletion.kt @@ -1,6 +1,5 @@ // DONT_TARGET_EXACT_BACKEND: WASM // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR fun nonGenericId(x: Any?) = x diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt index 462efc6f8a6..5d39246617e 100644 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt +++ b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt @@ -9,7 +9,7 @@ import kotlin.experimental.ExperimentalTypeInference @OptIn(ExperimentalTypeInference::class) fun scopedFlow(@BuilderInference block: suspend CoroutineScope.(FlowCollector) -> Unit): Flow = flow { - val collector = this + val collector = this flowScope { block(collector) } } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt index 067de1af171..23cda598c7d 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnType.fir.kt @@ -36,7 +36,7 @@ fun main(a: ReturnType) { takeNotNullStringAndKNullable(x1) takeNullableStringAndKNullable(x1) takeNotNullStringAndNotNullK(x1) - takeNullableStringAndNotNullK(x1) + takeNullableStringAndNotNullK(x1) takeNotNullString(a.foo41.foo411) val x2 = a.foo2() @@ -60,6 +60,6 @@ fun main(a: ReturnType) { val x5 = a.foo5() takeArrayOfNotNullString(x5) takeArrayOfNullableString(x5) - takeArrayOfNotNullK(x5) + takeArrayOfNotNullK(x5) takeArrayOfNullableK(x5) } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt index 0ad4f63b76e..faca5e38107 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.fir.kt @@ -37,26 +37,26 @@ fun main(a: ReturnTypeWithWarnings) { val x1 = a.foo1() takeNotNullStringAndKNullable(x1) takeNullableStringAndKNullable(x1) - takeNotNullStringAndNotNullK(x1) - takeNullableStringAndNotNullK(x1) + takeNotNullStringAndNotNullK(x1) + takeNullableStringAndNotNullK(x1) takeNotNullString(a.foo41.foo411) val x2 = a.foo2() takeNotNullStringAndKNullable(x2) takeNullableStringAndKNullable(x2) - takeNotNullStringAndNotNullK(x2) - takeNullableStringAndNotNullK(x2) + takeNotNullStringAndNotNullK(x2) + takeNullableStringAndNotNullK(x2) val x3 = a.foo3 takeNotNullStringAndKNullable(x3) takeNullableStringAndKNullable(x3) - takeNotNullStringAndNotNullK(x3) - takeNullableStringAndNotNullK(x3) + takeNotNullStringAndNotNullK(x3) + takeNullableStringAndNotNullK(x3) val x4 = a.foo4 takeArrayOfNotNullString(x4) takeArrayOfNullableString(x4) - takeArrayOfNotNullK(x4) + takeArrayOfNotNullK(x4) takeArrayOfNullableK(x4) val x5 = a.foo5() diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt index 2710e16342a..73c37ba246b 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeWithWarnings.kt @@ -37,21 +37,21 @@ fun main(a: ReturnTypeWithWarnings) { val x1 = ..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(; ReturnTypeWithWarnings.A!")!>x1) takeNullableStringAndKNullable(x1) - takeNotNullStringAndNotNullK(", "ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any", "R!")!>x1) + takeNotNullStringAndNotNullK(; ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any; R!")!>x1) takeNullableStringAndNotNullK(x1) - takeNotNullString(a.foo41.foo411) + takeNotNullString(a.foo41.foo411) val x2 = ..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(", "ReturnTypeWithWarnings.A!")!>x2) - takeNullableStringAndKNullable(", "ReturnTypeWithWarnings.A!")!>x2) - takeNotNullStringAndNotNullK(", "ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any", "R!")!>x2) + takeNotNullStringAndKNullable(; ReturnTypeWithWarnings.A!")!>x2) + takeNullableStringAndKNullable(; ReturnTypeWithWarnings.A!")!>x2) + takeNotNullStringAndNotNullK(; ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any; R!")!>x2) takeNullableStringAndNotNullK(x2) val x3 = ..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(", "ReturnTypeWithWarnings.A!")!>x3) - takeNullableStringAndKNullable(", "ReturnTypeWithWarnings.A!")!>x3) + takeNotNullStringAndKNullable(; ReturnTypeWithWarnings.A!")!>x3) + takeNullableStringAndKNullable(; ReturnTypeWithWarnings.A!")!>x3) takeNotNullStringAndNotNullK(x3) - takeNullableStringAndNotNullK(", "ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any", "R!")!>x3) + takeNullableStringAndNotNullK(; ReturnTypeWithWarnings.A!"), TYPE_MISMATCH("Any; R!")!>x3) val x4 = ..kotlin.Array)")!>a.foo4 takeArrayOfNotNullString(x4) diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.kt b/compiler/testData/diagnostics/tests/ResolveToJava.kt index 1f5c568a547..41451b3c014 100644 --- a/compiler/testData/diagnostics/tests/ResolveToJava.kt +++ b/compiler/testData/diagnostics/tests/ResolveToJava.kt @@ -21,7 +21,7 @@ fun test(l : java.util.List) { val f : java.io.File? = null - Collections.emptyList + Collections.emptyList Collections.emptyList Collections.emptyList() Collections.emptyList() diff --git a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt index bc172cb6c39..94cbcfbc607 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt @@ -12,7 +12,7 @@ annotation class Ann fun <@Ann R : @Ann Any> f3(a: Array<@Ann R>): Array<@Ann R?> = null!! fun test2(a: @Ann Array) { - val r: Array = f3(a) + val r: Array = f3(a) } diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt index 58d081614d1..fe61c362c4c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER fun takeFun(f: (T) -> Unit) {} @@ -14,12 +13,12 @@ fun Wrapper.baz(transform: (T) -> Unit): T = TODO() fun test() { takeFun(::foo) - takeFun(::fooInt) + takeFun(::fooInt) callFun>(::createWrapper) callFun>(::createWrapper) callFun>(::createWrapper) - callFun>(::createWrapper) + callFun>(::createWrapper) callFun>(::createWrapper).baz(::foo) } diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt b/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt index cd2e055d1fa..696ca84abb4 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE @@ -29,9 +28,9 @@ fun test(x: T) { baz(1, null, ::foo) baz(null, null, ::foo) - val s3: Pair = bar(null, null, ::foo) - val s4: Pair = bar(null, null, ::foo) + val s3: Pair = bar(null, null, ::foo) + val s4: Pair = bar(null, null, ::foo) - val s5: Pair = bar(1, "", ::foo) + val s5: Pair = bar(1, "", ::foo) val (a1: Int, b1: String) = bar(1, "", ::foo) } diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt index f454aa7ec2a..88e7357d6c9 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations annotation class Foo(val a: IntArray, val b: Array, val c: FloatArray) @@ -9,7 +8,7 @@ fun test1() {} @Foo([], [], []) fun test2() {} -@Foo([1f], [' '], [1]) +@Foo([1f], [' '], [1]) fun test3() {} @Foo(c = [1f], b = [""], a = [1]) diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt index 1f1be54f7a5..9e5ad622427 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations +BareArrayClassLiteral import kotlin.reflect.KClass @@ -21,10 +20,10 @@ fun test3() {} @Foo([Gen::class]) fun test4() {} -@Foo([""]) +@Foo([""]) fun test5() {} -@Foo([Int::class, 1]) +@Foo([Int::class, 1]) fun test6() {} @Bar diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt index d00209c47cf..d295b44bfb0 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt @@ -1,13 +1,12 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED fun test() { - val a = [] + val a = [] val b: Array = [] val c = [1, 2] val d: Array = [1, 2] - val e: Array = [1] + val e: Array = [1] val f: IntArray = [1, 2] val g = [f] @@ -20,5 +19,5 @@ fun check() { val f: IntArray = [1] [f] checkType { _>() } - [1, ""] checkType { _>() } + [1, ""] checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt index 1a84e6e26df..675c06b428b 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations annotation class Foo( @@ -8,9 +7,9 @@ annotation class Foo( ) annotation class Bar( - val a: Array = [' '], - val b: Array = ["", ''], - val c: Array = [1] + val a: Array = [' '], + val b: Array = ["", ''], + val c: Array = [1] ) annotation class Base( @@ -22,5 +21,5 @@ annotation class Base( annotation class Err( val a: IntArray = [1L], - val b: Array = [1] + val b: Array = [1] ) diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt b/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt index 37095d35174..249b8dac609 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER interface A { @@ -21,6 +20,6 @@ class D : A by baz({ it + 1 }) fun boo(t: T): A = AImpl() -class E : A by boo("") +class E : A by boo("") class F : A by AImpl() diff --git a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt index 280374b4327..75596472c75 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE package a fun foo0(f: () -> String) = f @@ -9,37 +8,37 @@ fun test1() { foo0 { "" } - foo0 { + foo0 { s: String-> "" } - foo0 { + foo0 { x, y -> "" } foo1 { "" } - foo1 { + foo1 { s: String -> "" } - foo1 { + foo1 { x, y -> "" } - foo1 { + foo1 { -> 42 } - foo2 { + foo2 { "" } - foo2 { + foo2 { s: String -> "" } - foo2 { + foo2 { x -> "" } - foo2 { + foo2 { -> 42 } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt index 8c78de2d146..c5d0c9c140f 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER -TOPLEVEL_TYPEALIASES_ONLY @@ -47,7 +46,7 @@ class Outer { x().bar() checkType { _>() } x = foobar() - x = z.foobar() + x = z.foobar() var y = noParameters() y = noParameters() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt index 1e47b515c93..c97b405bcfa 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER @@ -32,7 +31,7 @@ fun main() { checkSubtype.Inner<*>>(outer.Inner()) checkSubtype.Inner>(outer.bar()) - checkSubtype.Inner>(outer.Inner()) + checkSubtype.Inner>(outer.Inner()) outer.set(outer.bar()) outer.set(outer.Inner()) diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt index d90672d0e73..d6d8858ed8f 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt @@ -38,7 +38,7 @@ fun select(vararg x: R) = x[0] fun poll0(): Flow { return flow { - val inv = select(::bar, ::foo) + val inv = select(::bar, ::foo) inv() } } @@ -52,7 +52,7 @@ fun poll01(): Flow { fun poll02(): Flow { return flow { - val inv = select(::bar3, ::foo3) + val inv = select(::bar3, ::foo3) inv() } } @@ -66,7 +66,7 @@ fun poll03(): Flow { fun poll04(): Flow { return flow { - val inv = select(::bar5, ::foo5) + val inv = select(::bar5, ::foo5) inv } } @@ -437,7 +437,7 @@ fun poll76(): Flow { fun poll8(): Flow { return flow { - val inv = ::bar in setOf(::foo) + val inv = ::bar in setOf(::foo) inv() } } @@ -451,7 +451,7 @@ fun poll81(): Flow { fun poll82(): Flow { return flow { - val inv = ::bar3 in setOf(::foo3) + val inv = ::bar3 in setOf(::foo3) inv() } } @@ -465,7 +465,7 @@ fun poll83(): Flow { fun poll84(): Flow { return flow { - val inv = ::bar5 in setOf(::foo5) + val inv = ::bar5 in setOf(::foo5) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt index 27659dfcf19..7b62420519a 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt @@ -480,7 +480,7 @@ fun poll85(): Flow { fun poll86(): Flow { return flow { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } } @@ -494,7 +494,7 @@ fun poll87(): Flow { fun poll88(): Flow { return flow { - val inv = foo7() in setOf(::Foo7) + val inv = foo7() in setOf(::Foo7) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt index 29413894bcb..854da5f7888 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +UnrestrictedBuilderInference // !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE // WITH_RUNTIME +// FIR_IDE_IGNORE // FILE: Test.java diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt index f51543b7223..0353d0a3a36 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt @@ -1,17 +1,16 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // !CHECK_TYPE fun bar(a: Array): Array = null!! fun test1(a: Array) { - val r: Array = bar(a) - bar(a) + val r: Array = bar(a) + bar(a) } fun foo(l: Array): Array> = null!! fun test2(a: Array) { - val r: Array> = foo(a) - foo(a) + val r: Array> = foo(a) + foo(a) } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt index 1f5a6f7307d..042ac517fe1 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt @@ -1,10 +1,9 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_VARIABLE fun foo(array: Array>): Array> = array fun test(array: Array>) { - foo(array) + foo(array) - val f: Array> = foo(array) + val f: Array> = foo(array) } diff --git a/compiler/testData/diagnostics/tests/inference/completion/errorAfterCompletion.kt b/compiler/testData/diagnostics/tests/inference/completion/errorAfterCompletion.kt index 42e7d0e7d5e..d03c57ec839 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/errorAfterCompletion.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/errorAfterCompletion.kt @@ -4,5 +4,5 @@ fun foo(x: () -> Int): Int = x() fun myRun(x: () -> R): R = x() -private val a = foo { myRun { "OK" } } +private val a = foo { myRun { "OK" } } private val b: Int = myRun { "OK" } diff --git a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt index e34906914d3..f092b8cf38c 100644 --- a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt +++ b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE package a class MyList(t: T) {} @@ -14,7 +13,7 @@ fun readFromMyList(l: MyList, t: T) {} fun test1(int: Int, any: Any) { val a0 : MyList = getMyList(int) - val a1 : MyList = getMyList(any) + val a1 : MyList = getMyList(any) val a2 : MyList = getMyList(int) @@ -29,23 +28,23 @@ fun test1(int: Int, any: Any) { val a7 : MyList = getMyList(int) val a8 : MyList = getMyListToReadFrom(int) - val a9 : MyList = getMyListToReadFrom(int) + val a9 : MyList = getMyListToReadFrom(int) val a10 : MyList = getMyList(any) - val a11 : MyList = getMyList(any) + val a11 : MyList = getMyList(any) val a12 : MyList = getMyListToWriteTo(any) - val a13 : MyList = getMyListToWriteTo(any) + val a13 : MyList = getMyListToWriteTo(any) useMyList(getMyList(int), int) useMyList(getMyList(any), int) - useMyList(getMyList(int), any) + useMyList(getMyList(int), any) readFromMyList(getMyList(int), any) readFromMyList(getMyList(any), int) - readFromMyList(getMyList(any), int) + readFromMyList(getMyList(any), int) - readFromMyList(getMyListToReadFrom(any), int) + readFromMyList(getMyListToReadFrom(any), int) readFromMyList(getMyListToReadFrom(any), int) readFromMyList(getMyListToReadFrom(int), any) @@ -54,14 +53,14 @@ fun test1(int: Int, any: Any) { writeToMyList(getMyList(any), int) writeToMyList(getMyList(int), any) writeToMyList(getMyList(int), any) - writeToMyList(getMyList(int), any) + writeToMyList(getMyList(int), any) writeToMyList(getMyListToWriteTo(any), int) - writeToMyList(getMyListToWriteTo(int), any) + writeToMyList(getMyListToWriteTo(int), any) readFromMyList(getMyListToWriteTo(any), any) - writeToMyList(getMyListToReadFrom(any), any) + writeToMyList(getMyListToReadFrom(any), any) use(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt index ed1bd888a69..533bbca298a 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE //KT-2283 Bad diagnostics of failed type inference package a @@ -10,5 +9,5 @@ fun Foo.map(f: (A) -> B): Foo = object : Foo {} fun foo() { val l: Foo = object : Foo {} - val m: Foo = l.map { ppp -> 1 } + val m: Foo = l.map { ppp -> 1 } } diff --git a/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt b/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt index b7b925e0022..83b333dc36d 100644 --- a/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt @@ -1,10 +1,9 @@ -// !WITH_NEW_INFERENCE package typeInferenceExpectedTypeMismatch import java.util.* fun test() { - val s : Set = newList() + val s : Set = newList() use(s) } @@ -26,16 +25,16 @@ fun foo(o: Out, i: In): Two = throw Exception("$o $i") fun test1(outA: Out, inB: In) { foo(outA, inB) - val b: Two = foo(outA, inB) + val b: Two = foo(outA, inB) use(b) } fun bar(o: Out, i: In): Two = throw Exception("$o $i") fun test2(outA: Out, inC: In) { - bar(outA, inC) + bar(outA, inC) - val b: Two = bar(outA, inC) + val b: Two = bar(outA, inC) use(b) } diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt index 24b9d7a5d39..9272d580056 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE package a fun foo(v: V, u: U) = u @@ -16,7 +15,7 @@ fun checkItIsExactlyAny(t: T, l: MutableList) {} fun baz(v: V, u: MutableSet) = u fun test(a: Any, s: MutableSet) { - baz(a, s) + baz(a, s) } //from standard library diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt index 15182060056..0b96d957b2c 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE // FILE: Outer.java @@ -13,6 +12,6 @@ fun test(x: List, y: List) { Outer().Inner("", y, 1) checkType { _.Inner>() } Outer().Inner("", y, 1) checkType { _.Inner>() } - Outer().Inner("", x, 1) checkType { _.Inner>() } + Outer().Inner("", x, 1) checkType { _.Inner>() } Outer().Inner("", x, 1) } diff --git a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt index e54dcd28de9..7784d48802e 100644 --- a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt +++ b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt @@ -1,8 +1,7 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER fun test(a: Int, b: Boolean) { - bar(a.foo(b)) + bar(a.foo(b)) } fun T.foo(l: (T) -> R): R = TODO() diff --git a/compiler/testData/diagnostics/tests/regressions/kt10843.kt b/compiler/testData/diagnostics/tests/regressions/kt10843.kt index b4c9863a67a..50a313b667b 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt10843.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt10843.kt @@ -1,6 +1,6 @@ // NI_EXPECTED_FILE // See EA-76890 / KT-10843: NPE during analysis -fun lambda(x : Int?) = x?.let l { +fun lambda(x : Int?) = x?.let l { y -> if (y > 0) return@l x y diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt index 6c31f5036ce..b7238b621a5 100644 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt @@ -1,14 +1,13 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -USELESS_ELVIS fun test() { - bar(if (true) { - 1 + bar(if (true) { + 1 } else { - 2 + 2 }) - bar(1 ?: 2) + bar(1 ?: 2) } fun bar(s: String) = s diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt index 9d74c549038..f2c492ca95a 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE class A(x: Int) { @@ -21,8 +20,8 @@ val y4: B = B("") val y5: B = B(1) val y6: B = B("") -val y7: B = B(1) +val y7: B = B(1) val y8: B = B("") val y9 = B(1) -val y10 = B("") +val y10 = B("") diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt index f47da9ec8ab..b845a56107a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE interface Foo interface Bar : Foo @@ -13,14 +12,14 @@ val foo: Foo = run { x } -val foofoo: Foo = run { +val foofoo: Foo = run { val x = foo() if (x == null) throw Exception() - x + x } -val bar: Bar = run { +val bar: Bar = run { val x = foo() if (x == null) throw Exception() - x + x } diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt index 0fa88a6191e..ebbb5d1c5af 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST -// !WITH_NEW_INFERENCE // SKIP_TXT // Issue: KT-20849 @@ -40,7 +39,7 @@ class Context fun Any.decodeIn(typeFrom: Context): T = something() fun Any?.decodeOut1(typeFrom: Context): T { - return this?.decodeIn(typeFrom) ?: kotlin.Unit + return this?.decodeIn(typeFrom) ?: kotlin.Unit } fun Any.decodeOut2(typeFrom: Context): T { diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt index a780b6a296e..2bb834844d9 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt @@ -1,5 +1,3 @@ -// !LANGUAGE: -ProperTypeInferenceConstraintsProcessing - sealed class Subtype { abstract fun cast(value: A1): B1 class Trivial : Subtype() { diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt index a97be4f2c11..750ae8e26bd 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt @@ -6,6 +6,6 @@ sealed class Subtype { } fun unsafeCast(value: A): B { - val proof: Subtype = Subtype.Trivial() + val proof: Subtype = Subtype.Trivial() return proof.cast(value) } diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt index 79d3cd30e86..1e1d762655e 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt @@ -8,6 +8,6 @@ sealed class Subtype { } fun unsafeCast(value: A): B { - val proof: Subtype = Subtype.Trivial() + val proof: Subtype = Subtype.Trivial() return proof.cast(value) } diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt index 6c338972246..e52eb5f8c10 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt @@ -1,19 +1,18 @@ -// !WITH_NEW_INFERENCE // NI_EXPECTED_FILE class Num(val x: Tn) typealias N = Num val test0 = N(1) -val test1 = N("1") +val test1 = N("1") class Cons(val head: T, val tail: Cons?) typealias C = Cons typealias CC = C> -val test2 = C(1, 2) -val test3 = CC(1, 2) +val test2 = C(1, 2) +val test3 = CC(1, 2) val test4 = CC(C(1, null), null) @@ -21,13 +20,13 @@ class Pair(val x: X, val y: Y) typealias PL = Pair> typealias PN = Pair> -val test5 = PL(1, null) +val test5 = PL(1, null) class Foo(val p: Pair) typealias F = Foo -fun testProjections1(x: Pair) = F(x) -fun testProjections2(x: Pair) = F(x) -fun testProjections3(x: Pair) = F(x) -fun testProjections4(x: Pair) = F(x) +fun testProjections1(x: Pair) = F(x) +fun testProjections2(x: Pair) = F(x) +fun testProjections3(x: Pair) = F(x) +fun testProjections4(x: Pair) = F(x) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt index e58ef20f3b5..597625d0104 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt @@ -14,5 +14,5 @@ typealias C2 = MapLike val test1 = C(1, C(2, null)) val test2 = C(1, C("", null)) -val test23 = C2(if (true) 1 else null) -val test234 = C2(C2(if (true) 1 else null)) +val test23 = C2(if (true) 1 else null) +val test234 = C2(C2(if (true) 1 else null)) diff --git a/compiler/testData/diagnostics/tests/when/kt9972.kt b/compiler/testData/diagnostics/tests/when/kt9972.kt index c2c8c0b71bc..49664dcabb7 100644 --- a/compiler/testData/diagnostics/tests/when/kt9972.kt +++ b/compiler/testData/diagnostics/tests/when/kt9972.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) * @@ -11,18 +10,18 @@ */ fun test1(): Int { - val x: String = if (true) { + val x: String = if (true) { when { - true -> Any() - else -> null + true -> Any() + else -> null } } else "" return x.hashCode() } fun test2(): Int { - val x: String = when { - true -> Any() + val x: String = when { + true -> Any() else -> null } ?: return 0 return x.hashCode() diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt index 70b1df3fb99..a9c18a62361 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt @@ -1,5 +1,3 @@ -// !WITH_NEW_INFERENCE - import kotlin.reflect.KClass open class A @@ -14,7 +12,7 @@ class MyClass1 @Ann1(arrayOf(Any::class)) class MyClass1a -@Ann1(arrayOf(B1::class)) +@Ann1(arrayOf(B1::class)) class MyClass2 annotation class Ann2(val arg: Array>) @@ -25,5 +23,5 @@ class MyClass3 @Ann2(arrayOf(B1::class)) class MyClass4 -@Ann2(arrayOf(B2::class)) +@Ann2(arrayOf(B2::class)) class MyClass5 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt index 8db7a8ad9fb..55c57c14e0b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt @@ -1,5 +1,3 @@ -// !WITH_NEW_INFERENCE - import kotlin.reflect.KClass open class A @@ -11,7 +9,7 @@ annotation class Ann1(val arg: Array>) @Ann1(arrayOf(A::class)) class MyClass1 -@Ann1(arrayOf(Any::class)) +@Ann1(arrayOf(Any::class)) class MyClass1a @Ann1(arrayOf(B1::class)) @@ -19,11 +17,11 @@ class MyClass2 annotation class Ann2(val arg: Array>) -@Ann2(arrayOf(A::class)) +@Ann2(arrayOf(A::class)) class MyClass3 @Ann2(arrayOf(B1::class)) class MyClass4 -@Ann2(arrayOf(B2::class)) +@Ann2(arrayOf(B2::class)) class MyClass5 diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.fir.kt deleted file mode 100644 index 2e04a9642a5..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// !LANGUAGE: +UnrestrictedBuilderInference -// !USE_EXPERIMENTAL: kotlin.RequiresOptIn -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -// !WITH_NEW_INFERENCE - -@file:OptIn(ExperimentalTypeInference::class) - -import kotlin.experimental.ExperimentalTypeInference - -class GenericController { - suspend fun yield(t: T) {} - fun notYield(t: T) {} - - suspend fun yieldBarReturnType(t: T) = t - fun barReturnType(): T = TODO() -} - -fun generate(@BuilderInference g: suspend GenericController.() -> Unit): List = TODO() - -val test1 = generate { - yield(3) -} - -val test2 = generate { - yield(3) - notYield(3) -} - -val test3 = generate { - yield(3) - yieldBarReturnType(3) -} - -val test4 = generate { - yield(3) - barReturnType() -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt index 18bc1c971a6..444a6e0bd2f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +UnrestrictedBuilderInference // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE @@ -25,12 +26,12 @@ val test2 = generate { notYield(3) } -val test3 = generate { +val test3 = generate { yield(3) yieldBarReturnType(3) } -val test4 = generate { +val test4 = generate { yield(3) barReturnType() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt index 8a3a022d122..634ec01b919 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt @@ -1,6 +1,5 @@ // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -// !WITH_NEW_INFERENCE @file:OptIn(ExperimentalTypeInference::class) @@ -25,12 +24,12 @@ val test2 = generate { notYield(3) } -val test3 = generate { +val test3 = generate { yield(3) yieldBarReturnType(3) } -val test4 = generate { +val test4 = generate { yield(3) barReturnType() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt index 10a6d87c8da..1e0dc7cb6dc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt @@ -28,7 +28,7 @@ val memberWithoutAnn = wrongBuild< add(42) } -val extension = build { +val extension = build { extensionAdd("foo") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.fir.kt deleted file mode 100644 index 56c14cf632a..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !LANGUAGE: +UnrestrictedBuilderInference -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !WITH_NEW_INFERENCE - -// FILE: annotation.kt - -package kotlin - -annotation class BuilderInference - -// FILE: test.kt - -class GenericController { - suspend fun yield(t: T) {} -} - -suspend fun GenericController.extensionYield(s: S) {} - -@BuilderInference -suspend fun GenericController.safeExtensionYield(s: S) {} - -fun generate(@BuilderInference g: suspend GenericController.() -> Unit): List = TODO() - -val normal = generate { - yield(42) -} - -val extension = generate { - extensionYield("foo") -} - -val safeExtension = generate { - safeExtensionYield("foo") -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt index 0b34f3fe1ee..810fe20c229 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +UnrestrictedBuilderInference // !DIAGNOSTICS: -UNUSED_PARAMETER @@ -24,7 +25,7 @@ val normal = generate { yield(42) } -val extension = generate { +val extension = generate { extensionYield("foo") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt index c307234989f..86d13bf0ff0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -// !WITH_NEW_INFERENCE // FILE: annotation.kt @@ -24,7 +23,7 @@ val normal = generate { yield(42) } -val extension = generate { +val extension = generate { extensionYield("foo") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt index 104f9aef00e..3b72d9c46ab 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt @@ -1,6 +1,5 @@ // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER -// !WITH_NEW_INFERENCE // NI_EXPECTED_FILE @file:OptIn(ExperimentalTypeInference::class) @@ -15,10 +14,10 @@ fun generate(@BuilderInference g: suspend Controller.() -> Unit): S = TOD class A -val test1 = generate { +val test1 = generate { yield(A) } -val test2: Int = generate { - yield(A()) +val test2: Int = generate { + yield(A()) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt index 6fe54c84034..6d3ea869b66 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE -// !WITH_NEW_INFERENCE suspend fun await(f: V): V = f @@ -8,10 +7,10 @@ fun genericBuilder(c: suspend () -> T): T = null!! fun foo() { var result = "" genericBuilder { - try { + try { await("") } catch(e: Exception) { - result = "fail" + result = "fail" } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt b/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt index 444cb315df2..705295083df 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt @@ -1,5 +1,3 @@ -// !WITH_NEW_INFERENCE - // FILE: P.java import java.util.ArrayList; @@ -15,5 +13,5 @@ public class P { fun foo(c: P): MutableList { // Error should be here: see KT-8168 Typechecker fails for platform collection type - return c.getList() ?: listOf() + return c.getList() ?: listOf() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt index 7567dcb7c88..190f201aaf5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE //KT-4711 Error type with no error reported from type inference fun main() { @@ -7,15 +6,15 @@ fun main() { val startTimeNanos = System.nanoTime() // the problem sits on the next line: - val pi = 4.0.toDouble() * delta * (1..n).reduce( + val pi = 4.0.toDouble() * delta * (1..n).reduce( {t, i -> val x = (i - 0.5) * delta - t + 1.0 / (1.0 + x * x) + t + 1.0 / (1.0 + x * x) }) // !!! pi has error type here val elapseTime = (System.nanoTime() - startTimeNanos) / 1e9 - println("pi_sequential_reduce $pi $n $elapseTime") + println("pi_sequential_reduce $pi $n $elapseTime") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt index 622886f80cb..5f0a5795bbd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // SKIP_TXT class ExcA : Exception() @@ -27,9 +26,9 @@ fun test1(): Map = run { } fun test2(): Map = run { - try { + try { emptyMap() } catch (e: ExcA) { - mapOf("" to "") + mapOf("" to "") } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index b39de3a8fa3..019e7214f19 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -10998,6 +10998,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("labaledCall.kt") + public void testLabaledCall() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt"); + } + @TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt") public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/builderInference/simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt"); @@ -11028,15 +11033,106 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt"); } + @TestMetadata("specialCallsWithCallableReferencesErrorTypeUnrestricted.kt") + public void testSpecialCallsWithCallableReferencesErrorTypeUnrestricted() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorTypeUnrestricted.kt"); + } + @TestMetadata("specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt") public void testSpecialCallsWithCallableReferencesNonStrictOnlyInputTypes() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt"); } + @TestMetadata("specialCallsWithCallableReferencesUnrestricted.kt") + public void testSpecialCallsWithCallableReferencesUnrestricted() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.kt"); + } + @TestMetadata("specialCallsWithLambdas.kt") public void testSpecialCallsWithLambdas() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt"); } + + @TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference/constraints") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Constraints extends AbstractDiagnosisCompilerTestDataTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInConstraints() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference/constraints"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("violating.kt") + public void testViolating() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.kt"); + } + } + + @TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class StubTypes extends AbstractDiagnosisCompilerTestDataTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInStubTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("capturedTypes.kt") + public void testCapturedTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypes.kt"); + } + + @TestMetadata("commonSuperType.kt") + public void testCommonSuperType() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperType.kt"); + } + + @TestMetadata("commonSuperTypeContravariant.kt") + public void testCommonSuperTypeContravariant() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeContravariant.kt"); + } + + @TestMetadata("commonSuperTypeCovariant.kt") + public void testCommonSuperTypeCovariant() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt"); + } + + @TestMetadata("commonSuperTypeInvariant.kt") + public void testCommonSuperTypeInvariant() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeInvariant.kt"); + } + + @TestMetadata("commonSuperTypeNullable.kt") + public void testCommonSuperTypeNullable() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeNullable.kt"); + } + + @TestMetadata("intersect.kt") + public void testIntersect() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt"); + } + + @TestMetadata("memberScope.kt") + public void testMemberScope() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt"); + } + + @TestMetadata("nullability.kt") + public void testNullability() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt"); + } + + @TestMetadata("renderingStubTypes.kt") + public void testRenderingStubTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/renderingStubTypes.kt"); + } + } } @TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes") @@ -28249,6 +28345,41 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag public void testCompleteIrrelevantCalls() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/completeIrrelevantCalls.kt"); } + + @TestMetadata("incorrectCalls.kt") + public void testIncorrectCalls() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt"); + } + + @TestMetadata("incorrectCallsWithRestrictions.kt") + public void testIncorrectCallsWithRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt"); + } + + @TestMetadata("inferCoroutineTypeInOldVersion.kt") + public void testInferCoroutineTypeInOldVersion() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/inferCoroutineTypeInOldVersion.kt"); + } + + @TestMetadata("resolveUsualCallWithBuilderInference.kt") + public void testResolveUsualCallWithBuilderInference() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt"); + } + + @TestMetadata("resolveUsualCallWithBuilderInferenceWithRestrictions.kt") + public void testResolveUsualCallWithBuilderInferenceWithRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt"); + } + + @TestMetadata("useInferenceInformationFromExtension.kt") + public void testUseInferenceInformationFromExtension() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt"); + } + + @TestMetadata("useInferenceInformationFromExtensionWithRestrictions.kt") + public void testUseInferenceInformationFromExtensionWithRestrictions() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt"); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/builtins") @@ -29334,16 +29465,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraints_1_2.kt"); } - @TestMetadata("incorrectCalls.kt") - public void testIncorrectCalls() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt"); - } - - @TestMetadata("inferCoroutineTypeInOldVersion.kt") - public void testInferCoroutineTypeInOldVersion() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt"); - } - @TestMetadata("inferenceFromMethodInsideLocalVariable.kt") public void testInferenceFromMethodInsideLocalVariable() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt"); @@ -29464,11 +29585,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt"); } - @TestMetadata("resolveUsualCallWithBuilderInference.kt") - public void testResolveUsualCallWithBuilderInference() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt"); - } - @TestMetadata("returnTypeInference.kt") public void testReturnTypeInference() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference.kt"); @@ -29509,11 +29625,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt"); } - @TestMetadata("useInferenceInformationFromExtension.kt") - public void testUseInferenceInformationFromExtension() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt"); - } - @TestMetadata("variableCallInsideBuilderFunction.kt") public void testVariableCallInsideBuilderFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt");