diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java index c0b47263d86..ab3ea7d8e26 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java @@ -22223,9 +22223,9 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt"); } - @TestMetadata("implicitNothingAsTypeParameterNI.kt") - public void testImplicitNothingAsTypeParameterNI() throws Exception { - runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt"); + @TestMetadata("implicitNothingOnDelegates.kt") + public void testImplicitNothingOnDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt"); } @TestMetadata("misplacedConstraints.kt") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ImplicitNothingAsTypeParameterCallChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ImplicitNothingAsTypeParameterCallChecker.kt index 81683da2c6d..0abf56560d3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ImplicitNothingAsTypeParameterCallChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ImplicitNothingAsTypeParameterCallChecker.kt @@ -9,8 +9,11 @@ import com.intellij.psi.PsiElement import org.jetbrains.kotlin.builtins.isFunctionType import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.types.DeferredType +import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils import org.jetbrains.kotlin.types.typeUtil.isNothing +import org.jetbrains.kotlin.types.typeUtil.isTypeParameter object ImplicitNothingAsTypeParameterCallChecker : CallChecker { private val SPECIAL_FUNCTION_NAMES = ControlStructureTypingUtils.ResolveConstruct.values().map { it.specialFunctionName }.toSet() @@ -32,16 +35,21 @@ object ImplicitNothingAsTypeParameterCallChecker : CallChecker { * } */ override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { - if (resolvedCall.candidateDescriptor.name !in SPECIAL_FUNCTION_NAMES && resolvedCall.call.typeArguments.isEmpty()) { + val resultingDescriptor = resolvedCall.resultingDescriptor + val inferredReturnType = resultingDescriptor.returnType + if (inferredReturnType is DeferredType) + return + if (resultingDescriptor.name !in SPECIAL_FUNCTION_NAMES && resolvedCall.call.typeArguments.isEmpty()) { val lambdasFromArgumentsReturnTypes = resolvedCall.candidateDescriptor.valueParameters.filter { it.type.isFunctionType } .map { it.returnType?.arguments?.last()?.type }.toSet() + val unsubstitutedReturnType = resultingDescriptor.original.returnType + val expectedType = context.resolutionContext.expectedType + val hasImplicitNothing = inferredReturnType?.isNothing() == true && + unsubstitutedReturnType?.isTypeParameter() == true && + (TypeUtils.noExpectedType(expectedType) || !expectedType.isNothing()) - val hasImplicitNothingExceptLambdaReturnTypes = resolvedCall.typeArguments.any { (unsubstitutedType, resultingType) -> - resultingType.isNothing() && unsubstitutedType.defaultType !in lambdasFromArgumentsReturnTypes - } - - if (hasImplicitNothingExceptLambdaReturnTypes) { + if (hasImplicitNothing && unsubstitutedReturnType !in lambdasFromArgumentsReturnTypes) { context.trace.report(Errors.IMPLICIT_NOTHING_AS_TYPE_PARAMETER.on(reportOn)) } } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/nonLocalReturnUnreachable.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/nonLocalReturnUnreachable.kt index 7708127c2a5..f09cc4b1f50 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/nonLocalReturnUnreachable.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/nonLocalReturnUnreachable.kt @@ -14,7 +14,7 @@ fun doSomething() {} fun test2() { fun f(x: Any?) = x - f(null?.let { return }) + f(null?.let { return }) // false unreachable here doSomething() diff --git a/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_after.kt b/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_after.kt index 52d15ee4e69..01e8cb7fe8a 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_after.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_after.kt @@ -52,7 +52,7 @@ fun testLoopLabelInReturn(xs: List) { fun testValLabelInReturn() { L@ val fn = { return@L } - fn() + fn() } fun testHighOrderFunctionCallLabelInReturn() { diff --git a/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_before.kt b/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_before.kt index 00a174f3a88..df9a7999554 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_before.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/notAFunctionLabel_before.kt @@ -52,7 +52,7 @@ fun testLoopLabelInReturn(xs: List) { fun testValLabelInReturn() { L@ val fn = { return@L } - fn() + fn() } fun testHighOrderFunctionCallLabelInReturn() { diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt index 8f89d8247d3..8ee2dc801f5 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt @@ -24,7 +24,7 @@ fun foo(x: MC) { x.addAll(mc()) x.addAllMC(mc()) - x.addAll(c()) + x.addAll(c()) x.addAll(c()) x.addAllInv(mc()) diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt index b5b0572bc15..be388ac63a8 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt @@ -17,7 +17,7 @@ fun test(a: A, z: Out) { "" } a.bar { Out() } - a.bar { Out() } + a.bar { Out() } a.bar { z.id() } a.foo { diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt index b839c0e9fbb..e5d8d0dc248 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt @@ -14,9 +14,9 @@ class A { fun foo2(a: A, b: A) { a.foo1(Out()) - a.foo1<Out>(Out()) + a.foo1<Out>(Out()) - a.foo1(Out()) + a.foo1(Out()) a.foo1(Out()) a.foo2(Inv()) diff --git a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt index 39a4dc86ce6..601fe8f3cb6 100644 --- a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt @@ -7,6 +7,6 @@ fun foo1() { fooT22() } -val n : Nothing = null.sure() +val n : Nothing = null.sure() fun T?.sure() : T = this!! diff --git a/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt b/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt index c39ab2ce8f4..38b0c794753 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt @@ -9,8 +9,8 @@ inline fun foo2(f: (T) -> Unit): Foo = Foo() fun test1() { val f1: Foo = foo1 { it checkType { _() } } - val f2: Foo = foo1 { it checkType { _() } } + val f2: Foo = foo1 { it checkType { _() } } val f3: Foo = foo2 { it checkType { _() } } - val f4: Foo = foo2 { it checkType { _() } } + val f4: Foo = foo2 { it checkType { _() } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/implicitInvokeInCompanionObjectWithFunctionalArgument.kt b/compiler/testData/diagnostics/tests/inference/implicitInvokeInCompanionObjectWithFunctionalArgument.kt index a36031007e2..97ce5d18665 100644 --- a/compiler/testData/diagnostics/tests/inference/implicitInvokeInCompanionObjectWithFunctionalArgument.kt +++ b/compiler/testData/diagnostics/tests/inference/implicitInvokeInCompanionObjectWithFunctionalArgument.kt @@ -13,5 +13,5 @@ fun test(s: String): String { a checkType { _() } val b = TestClass { return s } - b checkType { _() } + b checkType { _() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/implicitInvokeInObjectWithFunctionalArgument.kt b/compiler/testData/diagnostics/tests/inference/implicitInvokeInObjectWithFunctionalArgument.kt index fedc2368891..f34d2b764c4 100644 --- a/compiler/testData/diagnostics/tests/inference/implicitInvokeInObjectWithFunctionalArgument.kt +++ b/compiler/testData/diagnostics/tests/inference/implicitInvokeInObjectWithFunctionalArgument.kt @@ -11,5 +11,5 @@ fun test(s: String): String { a checkType { _() } val b = TestClass { return s } - b checkType { _() } + b checkType { _() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/implicitInvokeWithFunctionLiteralArgument.kt b/compiler/testData/diagnostics/tests/inference/implicitInvokeWithFunctionLiteralArgument.kt index df74d11d940..4543d049289 100644 --- a/compiler/testData/diagnostics/tests/inference/implicitInvokeWithFunctionLiteralArgument.kt +++ b/compiler/testData/diagnostics/tests/inference/implicitInvokeWithFunctionLiteralArgument.kt @@ -8,7 +8,7 @@ class TestClass { fun test(value: T, test: TestClass): T { val x = test { return value } - x checkType { _() } + x checkType { _() } return value } diff --git a/compiler/testData/diagnostics/tests/j+k/flexibleNothing.kt b/compiler/testData/diagnostics/tests/j+k/flexibleNothing.kt index 83c4cc1047e..942b41dd65c 100644 --- a/compiler/testData/diagnostics/tests/j+k/flexibleNothing.kt +++ b/compiler/testData/diagnostics/tests/j+k/flexibleNothing.kt @@ -12,7 +12,7 @@ public class TestClass { fun run() { val testClass = TestClass() // inferred as `set()`, return type is Nothing! - testClass.set("test", null) + testClass.set("test", null) // Should not be unreachable run() diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/visitor.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/visitor.kt index 152cf3b0b44..ee932531ddb 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/visitor.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/visitor.kt @@ -22,5 +22,5 @@ public class Element { import p.* fun test(v: Visitor, e: Element) { - e.accept(v, null) + e.accept(v, null) } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/nullAsNothing.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/nullAsNothing.kt index b648a682d34..c8bd54ea24f 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/nullAsNothing.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/nullAsNothing.kt @@ -5,5 +5,5 @@ val y get() = null!! fun foo() { x checkType { _() } - y checkType { _() } + y checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt index c714d2bf47c..2c0d0e576c6 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST // !WITH_NEW_INFERENCE // SKIP_TXT // Issue: KT-20849 @@ -7,8 +7,8 @@ fun test_1(x: T): T = null as T fun test_2(x: () -> T): T = null as T fun case_1() { - null?.run { return } - null!!.run { throw Exception() } + null?.run { return } + null!!.run { throw Exception() } } fun case_2() { @@ -39,6 +39,53 @@ class Context fun Any.decodeIn(typeFrom: Context): T = something() -fun Any?.decodeOut(typeFrom: Context): T { - return this?.decodeIn(typeFrom) ?: error("") +fun Any?.decodeOut1(typeFrom: Context): T { + return this?.decodeIn(typeFrom) ?: kotlin.Unit } + +fun Any.decodeOut2(typeFrom: Context): T { + val x: Nothing = this.decodeIn(typeFrom) +} + +fun Any.decodeOut3(typeFrom: Context): T { + val x = this.decodeIn(typeFrom) +} + +fun Any.decodeOut4(typeFrom: Context): T { + val x: Any = this.decodeIn(typeFrom) +} + +class TrieNode { + companion object { + internal val EMPTY = TrieNode() + } +} +class PersistentHashSet(root: TrieNode) { + companion object { + internal val EMPTY = PersistentHashSet(TrieNode.EMPTY) + } +} + +interface F +fun F.join() = {} + +fun main() { + val f: Any = Any() + (f as F<*>).join() +} + +fun bug(worker: Worker) { + stateless { + onWorkerOutput(worker) + } +} + +fun RenderContext.onWorkerOutput(worker: Worker): Unit = Unit + +fun stateless( + render: RenderContext.(input: InputT) -> RenderingT +) { } + +interface Worker + +interface RenderContext diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt deleted file mode 100644 index 2f1e47710b2..00000000000 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt +++ /dev/null @@ -1,49 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST -// !LANGUAGE: +NewInference -// SKIP_TXT -// Issue: KT-20849 - -fun test_1(x: T.() -> T): T = null as T -fun test_2(x: (T) -> T): T = null as T -fun test_3(x: T.(T) -> T): T = null as T -fun test_4(x: T.(T) -> List): T = null as T -fun test_5(): List = 10 as List -fun test_6(): Map = 10 as Map - -fun case_1() { - test_5() - test_6() - val x = test_6() -} - -fun case_2() { - test_1 { null!! } -} - -fun case_3() { - test_2 { null!! } -} - -fun case_4() { - test_3 { null!! } -} - -fun case_5() { - test_4 { null!! } -} - -fun case_6() { - test_1 { throw Exception() } -} - -fun case_7() { - test_2 { throw Exception() } -} - -fun case_8() { - test_3 { throw Exception() } -} - -fun case_9() { - test_4 { throw Exception() } -} diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt new file mode 100644 index 00000000000..c545e095951 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt @@ -0,0 +1,23 @@ +// !DIAGNOSTICS: -UNCHECKED_CAST +// !WITH_NEW_INFERENCE +// WITH_RUNTIME +// WITH_REFLECT +// SKIP_TXT + +import kotlin.reflect.* + +private object Scope { + class Inv + + class Delegate(private val p: Inv) { + operator fun getValue(thisRef: Any?, property: KProperty<*>): T { + return materialize() + } + } + + fun materialize(): T = Any() as T + + fun test(i: Inv) { + val p: Int by Scope.Delegate(i) + } +} diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorCrazyProjections.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorCrazyProjections.kt index 75da660f5ba..fd3e6ec9b20 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorCrazyProjections.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorCrazyProjections.kt @@ -13,4 +13,4 @@ fun listOf(): List = null!! // since it has 'out' type projection in 'in' position. val test1 = BOutIn(listOf(), null!!) -val test2 = BInIn(listOf(), null!!) \ No newline at end of file +val test2 = BInIn(listOf(), null!!) \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt b/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt index 471fbbc25ce..f338d15b4d7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt @@ -4,12 +4,12 @@ fun test(mc: MutableCollection) { mc.addAll(mc) mc.addAll(arrayListOf()) - mc.addAll(arrayListOf()) + mc.addAll(arrayListOf()) mc.addAll(listOf("")) mc.addAll(listOf("")) mc.addAll(listOf("")) - mc.addAll(emptyList()) + mc.addAll(emptyList()) mc.addAll(emptyList()) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_2.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_2.kt index d610fb53ff5..2ed2a5338c2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_2.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_2.kt @@ -3,7 +3,7 @@ import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* -suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c -> +suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c -> c.resumeWithException(exception) COROUTINE_SUSPENDED } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_3.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_3.kt index 994c23d63b1..9cd56e7296f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_3.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/tailCalls/nothingTypedSuspendFunction_1_3.kt @@ -2,7 +2,7 @@ import kotlin.coroutines.* import kotlin.coroutines.intrinsics.* -suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c -> - c.resumeWithException(exception) +suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c -> + c.resumeWithException(exception) COROUTINE_SUSPENDED } diff --git a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt index 33f6d20c822..4dc8c7c7fcf 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt @@ -6,7 +6,7 @@ inline fun foo(block: () -> T): String = block().toString() inline fun javaClass(): Class = T::class.java fun box() { - val a = arrayOf(null!!) + val a = arrayOf(null!!) val b = Array<Nothing?>(5) { null!! } val c = foo() { null!! } val d = foo { null!! } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt index e0676ea14ae..43123407801 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt @@ -228,11 +228,11 @@ fun case_7(value_1: String?) { } when { value_1.case_7_10() == null -> println(value_1) - value_1.case_7_10() != null -> println(value_1) + value_1.case_7_10() != null -> println(value_1) } when { value_1.case_7_11() != null -> println(value_1) - value_1.case_7_11() == null -> println(value_1) + value_1.case_7_11() == null -> println(value_1) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt index f18818233a2..0b1de9ec267 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt @@ -89,7 +89,7 @@ fun case_3(value_1: Int?, value_2: Any?) { if (!value_1.case_3(value_1, value_2 is Number?)) { println(value_2?.toByte()) println(value_1.inv()) - } else if (value_1.case_3(value_1, value_2 is Number?)) { + } else if (value_1.case_3(value_1, value_2 is Number?)) { println(value_1) } else { println(value_1.inv()) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt index 3efb6b9d235..8ba4aa6e9cf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt @@ -74,7 +74,7 @@ fun case_4(x: Boolean?, y: Boolean?) { // TESTCASE NUMBER: 5 fun case_5(x: Boolean?, y: Boolean?) { while (true) { - y.to(break) + y.to(break) x!! } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 242862fc632..99fc24262ca 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -22305,9 +22305,9 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt"); } - @TestMetadata("implicitNothingAsTypeParameterNI.kt") - public void testImplicitNothingAsTypeParameterNI() throws Exception { - runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt"); + @TestMetadata("implicitNothingOnDelegates.kt") + public void testImplicitNothingOnDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt"); } @TestMetadata("misplacedConstraints.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 93729a77fd4..a08e2a4b987 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -22225,9 +22225,9 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameter.kt"); } - @TestMetadata("implicitNothingAsTypeParameterNI.kt") - public void testImplicitNothingAsTypeParameterNI() throws Exception { - runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingAsTypeParameterNI.kt"); + @TestMetadata("implicitNothingOnDelegates.kt") + public void testImplicitNothingOnDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt"); } @TestMetadata("misplacedConstraints.kt")