diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt index 02715a8d00b..e4e29a3eb28 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt @@ -110,7 +110,7 @@ fun ResolutionContext<*>.reportTypeMismatchDueToTypeProjection( } fun BindingTrace.reportDiagnosticOnce(diagnostic: Diagnostic) { - if (bindingContext.diagnostics.forElement(diagnostic.psiElement).any { it.factory == diagnostic.factory }) return + if (bindingContext.diagnostics.noSuppression().forElement(diagnostic.psiElement).any { it.factory == diagnostic.factory }) return report(diagnostic) } @@ -119,8 +119,10 @@ fun BindingTrace.reportDiagnosticOnceWrtDiagnosticFactoryList( diagnosticToReport: Diagnostic, vararg diagnosticFactories: DiagnosticFactory<*>, ) { - val hasAlreadyReportedDiagnosticFromListOrSameType = bindingContext.diagnostics.forElement(diagnosticToReport.psiElement) - .any { diagnostic -> diagnostic.factory == diagnosticToReport.factory || diagnosticFactories.any { it == diagnostic.factory } } + val hasAlreadyReportedDiagnosticFromListOrSameType = + bindingContext.diagnostics.noSuppression() + .forElement(diagnosticToReport.psiElement) + .any { diagnostic -> diagnostic.factory == diagnosticToReport.factory || diagnosticFactories.any { it == diagnostic.factory } } if (hasAlreadyReportedDiagnosticFromListOrSameType) return diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index 43b4a27c95f..7913de31407 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -48,6 +48,7 @@ import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstant import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver +import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression import org.jetbrains.kotlin.resolve.scopes.receivers.CastImplicitClassReceiver import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue @@ -554,6 +555,8 @@ class TrackingBindingTrace(val trace: BindingTrace) : BindingTrace by trace { var reported: Boolean = false override fun report(diagnostic: Diagnostic) { + if (bindingContext.diagnostics.noSuppression().forElement(diagnostic.psiElement).any { it == diagnostic }) return + trace.report(diagnostic) reported = true } diff --git a/compiler/testData/diagnostics/tests/annotations/dontReportWarningAboutChangingExecutionOrderForVararg.kt b/compiler/testData/diagnostics/tests/annotations/dontReportWarningAboutChangingExecutionOrderForVararg.kt index 94956926244..1e1e6c82b07 100644 --- a/compiler/testData/diagnostics/tests/annotations/dontReportWarningAboutChangingExecutionOrderForVararg.kt +++ b/compiler/testData/diagnostics/tests/annotations/dontReportWarningAboutChangingExecutionOrderForVararg.kt @@ -7,7 +7,7 @@ fun foo1() {} @Anno(x = ["a", "b"], y = "a") fun foo2() {} -@Anno(x = arrayOf(arrayOf("a"), arrayOf("b")), y = "a") +@Anno(x = arrayOf(arrayOf("a"), arrayOf("b")), y = "a") fun foo3() {} @Anno(x = arrayOf("a", "b"), y = "a") diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt index 17e5909d00c..58d081614d1 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER fun takeFun(f: (T) -> Unit) {} @@ -13,12 +14,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 a5573ce9a2a..cd2e055d1fa 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE @@ -28,9 +29,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 b6e772598f0..f454aa7ec2a 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations annotation class Foo(val a: IntArray, val b: Array, val c: FloatArray) @@ -8,7 +9,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 10fc6a66ae5..1f1be54f7a5 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations +BareArrayClassLiteral import kotlin.reflect.KClass @@ -20,10 +21,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 ec3b26925e1..d00209c47cf 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt @@ -1,12 +1,13 @@ +// !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] @@ -19,5 +20,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 882d362e46c..1a84e6e26df 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !LANGUAGE: +ArrayLiteralsInAnnotations annotation class Foo( @@ -7,9 +8,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( @@ -21,5 +22,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 c8c38aaab90..37095d35174 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER interface A { @@ -20,6 +21,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() +class F : A by AImpl() diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt b/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt index e4e7cb1ea03..7886561369d 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt @@ -18,9 +18,9 @@ fun test1(a: (Int) -> Unit) { } fun test2(a: (Int) -> Unit) { - test2(fun (x: String) {}) + test2(fun (x: String) {}) } fun test3(a: (Int, String) -> Unit) { - test3(fun (x: String) {}) + test3(fun (x: String) {}) } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt index 93d19bead5d..280374b4327 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE package a fun foo0(f: () -> String) = f @@ -8,37 +9,37 @@ fun test1() { foo0 { "" } - foo0 { + foo0 { s: String-> "" } - foo0 { + foo0 { x, y -> "" } foo1 { "" } - foo1 { + foo1 { s: String -> "" } - foo1 { + foo1 { x, y -> "" } - foo1 { - -> 42 + foo1 { + -> 42 } - foo2 { + foo2 { "" } - foo2 { + foo2 { s: String -> "" } - foo2 { + foo2 { x -> "" } - foo2 { - -> 42 + foo2 { + -> 42 } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt index 34821cc921b..cbd5a98bb4d 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt @@ -1,9 +1,9 @@ fun test(a: Int) { runf@{ - if (a > 0) return@f "" + if (a > 0) return@f "" return@f 1 } - run{ "" } + run{ "" } run{ 1 } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt index a834baca259..a52187189d0 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt @@ -44,7 +44,7 @@ fun test() { x().foo().a() checkType { _>() } x().bar() checkType { _>() } - x = foobar() + x = foobar() var y = noParameters() y = noParameters() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt index b34e6d45fc5..8c78de2d146 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER -TOPLEVEL_TYPEALIASES_ONLY @@ -45,8 +46,8 @@ class Outer { x().foo().a() checkType { _>() } x().bar() checkType { _>() } - x = foobar() - x = z.foobar() + x = 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 c97b405bcfa..1e47b515c93 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER @@ -31,7 +32,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/generics/projectionsScope/typeMismatchInLambda.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt index f1917f2309b..5adeb4ca8c8 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt @@ -13,14 +13,14 @@ class A { fun test(a: A, z: Out) { a.foo { val x: String = 1 // Should be no TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS - "" + "" } - a.bar { Out() } + a.bar { Out() } a.bar { Out() } - a.bar { z.id() } + a.bar { z.id() } a.foo { - z.foobar(if (1 > 2) return@foo "" else "") - "" + z.foobar(if (1 > 2) return@foo "" else "") + "" } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.kt b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.kt index 837510fd8a3..1ea07c7ff4d 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.kt @@ -8,26 +8,26 @@ interface A { @ExperimentalStdlibApi fun main() { buildList { - add(3) + add(3) object : A { override fun foo(): MutableList = this@buildList } } buildList { - add(3) + add(3) val x: String = get(0) } buildList { - add("3") + add("3") val x: MutableList = this@buildList } buildList { val y: CharSequence = "" - add(y) + add(y) val x: MutableList = this@buildList } buildList { - add("") + add("") val x: StringBuilder = get(0) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt index 0134ee521ae..e8f405c2b08 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt @@ -147,7 +147,7 @@ fun poll73(): Flow { fun poll8(): Flow { return flow { - val inv = {1} in setOf({1f}) + val inv = {1} in setOf({1f}) inv() } } @@ -175,7 +175,7 @@ fun poll83(): Flow { fun poll84(): Flow { return flow { - val inv = {{1}} in setOf({{1f}}) + val inv = {{1}} in setOf({{1f}}) inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt index 7b672750db7..c938e6cacee 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt @@ -26,7 +26,7 @@ fun test() { get()?.hashCode() get()?.equals(1) // there is `String?.equals` extension - get().equals("") + get().equals("") } val ret2 = build { emit(1) @@ -39,7 +39,7 @@ fun test() { val x = get() x?.hashCode() x?.equals(1) - x.equals("") + x.equals("") } val ret3 = build { emit(1) @@ -74,7 +74,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.hashCode() + x.hashCode() } "" @@ -84,7 +84,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.equals("") + x.equals("") } "" @@ -104,7 +104,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.test() + x.test() } "" @@ -114,7 +114,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.hashCode() + x.hashCode() } "" @@ -124,7 +124,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.equals("") + x.equals("") } "" @@ -144,7 +144,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.test() + x.test() } "" @@ -153,7 +153,7 @@ fun test() { emit(1) emit(null) val x = get() - x.test() + x.test() "" } @@ -211,7 +211,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.equals("") + x.equals("") } "" @@ -221,7 +221,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.hashCode() + x.hashCode() } "" } @@ -230,7 +230,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.toString() + x.toString() } "" } @@ -239,7 +239,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.test() + x.test() } "" } @@ -248,7 +248,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.equals("") + x.equals("") } "" @@ -258,7 +258,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.hashCode() + x.hashCode() } "" } @@ -267,7 +267,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.toString() + x.toString() } "" } @@ -276,7 +276,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.test() + x.test() } "" } @@ -284,7 +284,7 @@ fun test() { emit(1) emit(null) val x = get() - x.test() + x.test() "" } val ret51 = build { diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt index 381f116b394..f51543b7223 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/cannotCaptureInProjection.kt @@ -1,16 +1,17 @@ +// !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 f1239dc2163..1f5a6f7307d 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt @@ -1,9 +1,10 @@ +// !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/coercionToUnit/kt30242.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt index a696d66ea85..323c3ffbecd 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt @@ -47,7 +47,7 @@ fun bar(block: () -> String) {} fun test_5(b: Boolean) { bar { - if (b) { + if (b) { println("meh") } } diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt index 2c102c68e2f..15be9d5dec5 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt @@ -119,8 +119,8 @@ fun main() { * K <: (A) -> Unit -> TypeVariable(_RP1) >: A * K >: (C) -> TypeVariable(_R) -> TypeVariable(_RP1) <: C */ - val x12 = selectC(id { it }, id { x: B -> }) - val x13 = selectA(id { it }, id { x: C -> }) + val x12 = selectC(id { it }, id { x: B -> }) + val x13 = selectA(id { it }, id { x: C -> }) val x14 = selectC(id { it }, id { x: A -> }, { x -> x }) val x15 = selectC(id { it }, { x: A -> }, id { x -> x }) /* diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/notInferableParameterOfAnonymousFunction.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/notInferableParameterOfAnonymousFunction.kt index 59217dfffc7..59bb7b4438e 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/notInferableParameterOfAnonymousFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/notInferableParameterOfAnonymousFunction.kt @@ -4,13 +4,13 @@ fun select(vararg x: T) = x[0] fun id(x: K) = x fun main() { - val x1 = select(id { x, y -> }, { x: Int, y -> }) + val x1 = select(id { x, y -> }, { x: Int, y -> }) val x2 = select(id { x, y -> }, { x: Int, y -> }) val x3 = select(id(fun (x, y) {}), fun (x: Int, y) {}) val x4 = select((fun (x, y) {}), fun (x: Int, y) {}) - val x5 = select(id(fun (x, y) {}), fun (x: Int, y) {}) + val x5 = select(id(fun (x, y) {}), fun (x: Int, y) {}) val x6 = id(fun (x) {}) select(fun (x) {}, fun (x) {}) diff --git a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt index 024ec3106f1..c6aedf47367 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt @@ -262,8 +262,8 @@ class Main(x: L?, y: L) { val x471 = >>")!>foo47(y) fun takeLambda(block: () -> R): R = materialize() - val x480 = ")!>takeLambda { foo48 { x } } - val x481 = ")!>takeLambda { foo48 { y } } + val x480 = ")!>takeLambda { foo48 { x } } + val x481 = ")!>takeLambda { foo48 { y } } val x482 = ")!>takeLambda { foo48 { null } } } diff --git a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt index ce768e2a60c..e34906914d3 100644 --- a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt +++ b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE package a class MyList(t: T) {} @@ -13,7 +14,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) @@ -28,23 +29,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) @@ -53,14 +54,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 4ebb50e9f2f..ed1bd888a69 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE //KT-2283 Bad diagnostics of failed type inference package a @@ -9,5 +10,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 bb52ba6584f..b7b925e0022 100644 --- a/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt @@ -1,9 +1,10 @@ +// !WITH_NEW_INFERENCE package typeInferenceExpectedTypeMismatch import java.util.* fun test() { - val s : Set = newList() + val s : Set = newList() use(s) } @@ -25,16 +26,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 b1a67497700..24b9d7a5d39 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE package a fun foo(v: V, u: U) = u @@ -15,7 +16,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 0b96d957b2c..15182060056 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !CHECK_TYPE // FILE: Outer.java @@ -12,6 +13,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/j+k/genericConstructor/noClassTypeParametersInvParameter.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt index d9b8943e60f..7ba83bd7575 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt @@ -12,7 +12,7 @@ fun test(x: Inv, y: Inv) { A("", x) A("", y) - A("", x) + A("", x) A("", x) A("", y) diff --git a/compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt b/compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt index a78d74bb7cd..ecd158d8d90 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt @@ -18,5 +18,5 @@ fun test(a: A, b: B, c: C) { b.f { } c.f { } C().f { } - C.g { } + C.g { } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt index 5d73a4d031b..491b74c0454 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt @@ -18,10 +18,10 @@ fun main() { J { s: String -> s} // should be prohibited, because SAM value parameter has nullable type J { "" + it.length } J { null } - J { it?.length?.toString() } + J { it?.length?.toString() } J2 { s: String -> s} J2 { "" + it.length } J2 { null } - J2 { it?.length?.toString() } + J2 { it?.length?.toString() } } diff --git a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt index 89228862837..7fe17f099ea 100644 --- a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt +++ b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt @@ -33,7 +33,7 @@ fun main() { } A.baz { - x -> x.hashCode() + x -> x.hashCode() } val block: (String) -> Any? = { diff --git a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt index 9613fd9b519..e54dcd28de9 100644 --- a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt +++ b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt @@ -1,7 +1,8 @@ +// !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/resolveCollectionLiteralInsideLambda.kt b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt index a3fa7cfc78c..2483266f885 100644 --- a/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt +++ b/compiler/testData/diagnostics/tests/regressions/resolveCollectionLiteralInsideLambda.kt @@ -4,4 +4,4 @@ fun foo(l: () -> Unit) {} fun bar(l: () -> String) {} val a = foo { [] } -val b = bar { [] } \ No newline at end of file +val b = bar { [] } diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt index 34817b55440..6c31f5036ce 100644 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/constantsInIf.kt @@ -1,13 +1,14 @@ +// !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 59bbe40ef17..9d74c549038 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE class A(x: Int) { @@ -20,8 +21,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 c73e2efec83..f47da9ec8ab 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE interface Foo interface Bar : Foo @@ -12,14 +13,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/smartCasts/localFunChanges.kt b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt index c3d6717fdb1..207c3d3d93f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt @@ -8,7 +8,7 @@ fun foo() { return true } i.hashCode() - trans(i, ::can) + trans(i, ::can) i.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt index c3db758b8cd..d9756feaa31 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt @@ -16,7 +16,7 @@ fun foo(): Int { k.run() val d: Int = c // a is captured so smart cast is not possible - return d + a + return d + a } else return -1 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt index c80306e473d..996ae3faf0c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt @@ -5,5 +5,5 @@ fun foo(x: Int, f: () -> Unit, y: Int) {} fun bar() { var x: Int? x = 4 - foo(x, { x = null; x.hashCode() }, x) + foo(x, { x = null; x.hashCode() }, x) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt index 751bffeea33..cdbdcaf9932 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt @@ -6,5 +6,5 @@ fun bar(s: String): Int { fun foo(m: MyClass): Int { m.p = "xyz" - return bar(m.p) + return bar(m.p) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt index 921a5beb588..c8d713bc51c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt @@ -8,7 +8,7 @@ fun IntArray.forEachIndexed( op: (i: Int, value: Int) -> Unit) { fun max(a: IntArray): Int? { var maxI: Int? = null a.forEachIndexed { i, value -> - if (maxI == null || value >= a[maxI]) + if (maxI == null || value >= a[maxI]) maxI = i } return maxI diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt index 63552fea2e5..0fa88a6191e 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST +// !WITH_NEW_INFERENCE // SKIP_TXT // Issue: KT-20849 @@ -39,7 +40,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.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt index 3d44da71dfe..a97be4f2c11 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt @@ -1,5 +1,3 @@ -// !LANGUAGE: -ProperTypeInferenceConstraintsProcessing - sealed class Subtype { abstract fun cast(value: A1): B1 class Trivial : Subtype() { @@ -8,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/typealias/typeAliasConstructorTypeArgumentsInference.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt index 96f71bb6eac..6c338972246 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt @@ -1,18 +1,19 @@ +// !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) @@ -20,13 +21,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 a21eeae5748..e58ef20f3b5 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.kt @@ -13,6 +13,6 @@ typealias C = Cons 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 test2 = C(1, C("", 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/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt index 91b4d970823..986d1e0f5b1 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt @@ -62,7 +62,7 @@ fun test() { takeUByte(LONG_CONST) takeUByte(NON_CONST) - takeUByte(BIGGER_THAN_UBYTE) + takeUByte(BIGGER_THAN_UBYTE) takeUByte(UINT_CONST) takeUIntWithoutAnnotaion(IMPLICIT_INT) } diff --git a/compiler/testData/diagnostics/tests/when/kt9972.kt b/compiler/testData/diagnostics/tests/when/kt9972.kt index 8a2b11c44d4..c2c8c0b71bc 100644 --- a/compiler/testData/diagnostics/tests/when/kt9972.kt +++ b/compiler/testData/diagnostics/tests/when/kt9972.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) * @@ -10,18 +11,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 4f3c8271e94..70b1df3fb99 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsInVariance.kt @@ -1,3 +1,5 @@ +// !WITH_NEW_INFERENCE + import kotlin.reflect.KClass open class A @@ -12,7 +14,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>) @@ -23,5 +25,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 834992e19db..8db7a8ad9fb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/kClass/kClassArrayInAnnotationsOutVariance.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE import kotlin.reflect.KClass @@ -10,7 +11,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)) @@ -18,11 +19,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/coroutines/inference/plusAssignWithLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignWithLambda.kt index d7323032074..e0fcf8ed34c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignWithLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/plusAssignWithLambda.kt @@ -37,6 +37,6 @@ class B { } fun foo3(x: B) = { - x += { "" } + x += { "" } x += id { "" } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt index 784b7d3be3a..104f9aef00e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt @@ -1,5 +1,6 @@ // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER +// !WITH_NEW_INFERENCE // NI_EXPECTED_FILE @file:OptIn(ExperimentalTypeInference::class) @@ -14,10 +15,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/lambdaExpectedType.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt index 12d1442698d..d30fb2c33e4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt @@ -28,7 +28,7 @@ fun foo() { i = genericBuilder { 1 } genericBuilder { 1 } genericBuilder { 1 } - genericBuilder { "" } + genericBuilder { "" } val y = { 1 } genericBuilder(y) @@ -43,7 +43,7 @@ fun foo() { val s: String = manyArgumentsBuilder({}, { "" }) { 1 } manyArgumentsBuilder({}, { "" }, { 1 }) - manyArgumentsBuilder({}, { 1 }, { 2 }) + manyArgumentsBuilder({}, { 1 }, { 2 }) severalParamsInLambda { x, y -> x checkType { _() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt index 754b5a833d9..6fe54c84034 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE +// !WITH_NEW_INFERENCE suspend fun await(f: V): V = f @@ -7,10 +8,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 1f9cc495860..444cb315df2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/elvisOnJavaList.kt @@ -1,3 +1,5 @@ +// !WITH_NEW_INFERENCE + // FILE: P.java import java.util.ArrayList; @@ -13,5 +15,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/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt index be8a30e59c5..56d3ec00b86 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt @@ -19,7 +19,7 @@ fun main() { val x1: suspend (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit")!>{ x -> x }) // Here, the error should be - val x2: (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x3: suspend (Int) -> Unit = takeSimpleFunction( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}) + val x2: (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH!>{ x -> x }) + val x3: suspend (Int) -> Unit = takeSimpleFunction( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH!>{ x -> x }) + val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, kotlin.Unit"), TYPE_MISMATCH!>{}) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt index 4efea558376..7567dcb7c88 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE //KT-4711 Error type with no error reported from type inference fun main() { @@ -6,15 +7,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/smartcasts/forEachSafe.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt index ee3ecd7926d..6457395997b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt @@ -3,7 +3,7 @@ fun indexOfMax(a: IntArray): Int? { var maxI: Int? = null a.forEachIndexed { i, value -> - if (maxI == null || value >= a[maxI]) { + if (maxI == null || value >= a[maxI]) { maxI = i } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt index a5dd533a84a..622886f80cb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // SKIP_TXT class ExcA : Exception() @@ -26,9 +27,9 @@ fun test1(): Map = run { } fun test2(): Map = run { - try { + try { emptyMap() } catch (e: ExcA) { - mapOf("" to "") + mapOf("" to "") } }