diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/jvm/RuntimeAssertions.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/jvm/RuntimeAssertions.kt index 13c7ec15186..5a1432bf5d1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/jvm/RuntimeAssertions.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/jvm/RuntimeAssertions.kt @@ -92,7 +92,7 @@ public object RuntimeAssertionsTypeChecker : AdditionalTypeChecker { expressionType, object : RuntimeAssertionInfo.DataFlowExtras { override val canBeNull: Boolean - get() = c.dataFlowInfo.getNullability(dataFlowValue).canBeNull() + get() = c.dataFlowInfo.getPredictableNullability(dataFlowValue).canBeNull() override val possibleTypes: Set get() = c.dataFlowInfo.getPossibleTypes(dataFlowValue) override val presentableText: String diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityWarningsChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityWarningsChecker.kt index ac729e8d0f4..968d70516bf 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityWarningsChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JavaNullabilityWarningsChecker.kt @@ -71,7 +71,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker { if (TypeUtils.noExpectedType(expectedType)) return val expectedMustNotBeNull = expectedType.mustNotBeNull() - if (dataFlowInfo.getNullability(dataFlowValue) == Nullability.NOT_NULL) return + if (dataFlowInfo.getPredictableNullability(dataFlowValue) == Nullability.NOT_NULL) return val actualMayBeNull = expressionType.mayBeNull() @@ -155,7 +155,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker { } private fun doIfNotNull(dataFlowValue: DataFlowValue, c: ResolutionContext<*>, body: () -> T): T? { - if (c.dataFlowInfo.getNullability(dataFlowValue).canBeNull() + if (c.dataFlowInfo.getPredictableNullability(dataFlowValue).canBeNull() && dataFlowValue.type.mustNotBeNull() == ErrorsJvm.NullabilityInformationSource.JAVA) { return body() } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt index 1eb0c7acccb..33cf15724b0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt @@ -475,7 +475,7 @@ public class CandidateResolver( val bindingContext = trace.bindingContext val receiverValue = DataFlowValueFactory.createDataFlowValue(receiverArgument, bindingContext, scope.ownerDescriptor) - if (safeAccess && !dataFlowInfo.getNullability(receiverValue).canBeNull()) { + if (safeAccess && !dataFlowInfo.getPredictableNullability(receiverValue).canBeNull()) { tracing.unnecessarySafeCall(trace, receiverArgument.type) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.java index 2fe2c8b4d37..ad367f92101 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.java @@ -37,9 +37,19 @@ public interface DataFlowInfo { @NotNull SetMultimap getCompleteTypeInfo(); + /** + * Returns collected nullability for the given value, NOT taking its predictability into account. + */ @NotNull Nullability getNullability(@NotNull DataFlowValue key); + /** + * Returns collected nullability for the given value if it's predictable. + * Otherwise basic value nullability is returned + */ + @NotNull + Nullability getPredictableNullability(@NotNull DataFlowValue key); + /** * IMPORTANT: by default, the original (native) type for this value * are NOT included. So it's quite possible to get an empty set here. diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.java index 2ededc9318b..3044c9b48cd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.java @@ -111,7 +111,18 @@ import static org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL @Override @NotNull public Nullability getNullability(@NotNull DataFlowValue key) { - if (!key.isPredictable()) return key.getImmanentNullability(); + return getNullability(key, false); + } + + @Override + @NotNull + public Nullability getPredictableNullability(@NotNull DataFlowValue key) { + return getNullability(key, true); + } + + @NotNull + private Nullability getNullability(@NotNull DataFlowValue key, boolean predictableOnly) { + if (predictableOnly && !key.isPredictable()) return key.getImmanentNullability(); Nullability nullability = nullabilityInfo.get(key); return nullability != null ? nullability : parent != null ? parent.getNullability(key) : @@ -123,7 +134,6 @@ import static org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL @NotNull DataFlowValue value, @NotNull Nullability nullability ) { - if (!value.isPredictable()) return false; map.put(value, nullability); return nullability != getNullability(value); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index 4ba6b0d954f..a72bbe9d2ad 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -892,7 +892,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { private static boolean isKnownToBeNotNull(KtExpression expression, KotlinType jetType, ExpressionTypingContext context) { DataFlowValue dataFlowValue = createDataFlowValue(expression, jetType, context); - return !context.dataFlowInfo.getNullability(dataFlowValue).canBeNull(); + return !context.dataFlowInfo.getPredictableNullability(dataFlowValue).canBeNull(); } /** @@ -1191,7 +1191,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { DataFlowInfo rightDataFlowInfo = resolvedCall.getDataFlowInfoForArguments().getResultInfo(); // left argument is considered not-null if it's not-null also in right part or if we have jump in right part if ((rightType != null && KotlinBuiltIns.isNothingOrNullableNothing(rightType) && !rightType.isMarkedNullable()) - || !rightDataFlowInfo.getNullability(leftValue).canBeNull()) { + || !rightDataFlowInfo.getPredictableNullability(leftValue).canBeNull()) { dataFlowInfo = dataFlowInfo.disequate(leftValue, DataFlowValue.nullValue(components.builtIns)); } } @@ -1298,7 +1298,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { new Function1() { @Override public Nullability invoke(DataFlowValue value) { - return context.dataFlowInfo.getNullability(value); + return context.dataFlowInfo.getPredictableNullability(value); } }); } diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaUsesOwnerModifies.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaUsesOwnerModifies.kt index 957dfd8e27f..aef2f644df7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaUsesOwnerModifies.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaUsesOwnerModifies.kt @@ -6,7 +6,7 @@ fun foo(arg: Int?) { if (x == null) return run { // Not safe: x = null later in the owner - x.hashCode() + x.hashCode() } x = null } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/localClassChanges.kt b/compiler/testData/diagnostics/tests/smartCasts/localClassChanges.kt index b3748fde2c0..de9051f9ea1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localClassChanges.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localClassChanges.kt @@ -8,8 +8,8 @@ fun foo() { i = null } } - i.hashCode() + i.hashCode() Changing().bar() - i.hashCode() + i.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt index c748e29156b..75054ca9765 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt @@ -7,8 +7,8 @@ fun foo() { i = null return true } - i.hashCode() - trans(i, ::can) - i.hashCode() + i.hashCode() + trans(i, ::can) + i.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/localObjectChanges.kt b/compiler/testData/diagnostics/tests/smartCasts/localObjectChanges.kt index 1fd04697241..ea0ddbef8f5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localObjectChanges.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localObjectChanges.kt @@ -10,6 +10,6 @@ fun foo() { i = null } }.bar() - i.hashCode() + i.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.kt b/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.kt index 5c64093a0d4..22dee62b9a1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.kt @@ -6,10 +6,10 @@ fun foo(arg: Int?) { if (x == null) return run { // Unsafe because of owner modification - x.hashCode() + x.hashCode() x = null } if (x != null) x = 42 // Unsafe because of lambda - x.hashCode() + x.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt new file mode 100644 index 00000000000..ea7b2718112 --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt @@ -0,0 +1,13 @@ +class Immutable(val x: String?) { + fun foo(): String { + if (x != null) return x + return "" + } +} + +class Mutable(var y: String?) { + fun foo(): String { + if (y != null) return y + return "" + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.txt b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.txt new file mode 100644 index 00000000000..9a974fe5ffc --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.txt @@ -0,0 +1,19 @@ +package + +public final class Immutable { + public constructor Immutable(/*0*/ x: kotlin.String?) + public final val x: kotlin.String? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Mutable { + public constructor Mutable(/*0*/ y: kotlin.String?) + public final var y: kotlin.String? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt index 6cbdc76ca22..645344871e1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt @@ -5,7 +5,7 @@ public class X { public fun fn(): Int { if (y != null) // With non-default getter smartcast is not possible - return y.length + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt index ec98bc2d6ea..c7a0cc99951 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt @@ -13,7 +13,7 @@ class Example { public fun foo(): String { // Smart cast is not possible if property is delegated - return if (p != null) p else "" + return if (p != null) p else "" } public fun bar(): String { diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt index 10449588bdd..c5496f9ab03 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt @@ -17,7 +17,7 @@ import a.X public fun X.gav(): Int { if (x != null) // Smart cast is not possible if definition is in another module - return x.length + return x.length else return 0 } @@ -29,7 +29,7 @@ package a public fun X.gav(): Int { if (x != null) // Even if it's in the same package - return x.length + return x.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt index 8b8e840c20a..c8ca4850b83 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt @@ -4,10 +4,10 @@ public class X { public fun fn(): Int { if (x != null) // Smartcast is not possible for variable properties - return x.length + return x.length else if (y != null) // Even if they are private - return y.length + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt index 2ae32c96ee8..cd36cd908b5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt @@ -7,11 +7,11 @@ public fun foo() { } else if (s == null) { return -2 } else { - return s.length // Here smartcast is possible, at least in principle + return s.length // Here smartcast is possible, at least in principle } } if (s != null) { System.out.println(closure()) - System.out.println(s.length) // Here smartcast is not possible due to a closure predecessor + System.out.println(s.length) // Here smartcast is not possible due to a closure predecessor } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt index 8acd935b33f..4690ee9d570 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/testsWithStdLib/smartcasts/forEachSafe.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt index 4bec6488c4c..b61581af7b1 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/smartcasts/letChangesToNull.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNull.kt index d320fa3509a..20379407b97 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNull.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNull.kt @@ -4,6 +4,6 @@ fun foo(y: String?) { var x: String? = "" if (x != null) { y?.let { x = null } - x.length // Smart cast is not possible + x.length // Smart cast is not possible } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.kt index 76d58492ea1..21b482bb7d1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.kt @@ -6,6 +6,6 @@ fun foo(y: String?) { var x: String? = "" if (x != null) { bar(y?.let { x = null; it }).length - x.length // Smart cast is not possible + x.length // Smart cast is not possible } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letMergeNotNull.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letMergeNotNull.kt index be19cc5cfd9..ecdc0a817a1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letMergeNotNull.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letMergeNotNull.kt @@ -4,6 +4,6 @@ fun foo(y: String?) { var x: String? = null if (x != null) { y?.let { x = it } - x.length // not-null or not-null + x.length // not-null or not-null } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.kt index ddaab04f303..e2f70ab2157 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.kt @@ -3,8 +3,8 @@ fun foo(y: String?) { if (x != null) { with(y?.let { x = null; it }) { this.length - x.length + x.length } - x.length + x.length } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 7a898f93581..164801f91ea 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -14619,6 +14619,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("propertyToNotNull.kt") + public void testPropertyToNotNull() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt"); + doTest(fileName); + } + @TestMetadata("thisWithLabel.kt") public void testThisWithLabel() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/thisWithLabel.kt"); diff --git a/idea/testData/checker/infos/SmartCasts.kt b/idea/testData/checker/infos/SmartCasts.kt index 54812d9a126..224a5b2b2a2 100644 --- a/idea/testData/checker/infos/SmartCasts.kt +++ b/idea/testData/checker/infos/SmartCasts.kt @@ -231,8 +231,7 @@ class Mutable(var x: Stri return x } if (x != null) { - // It would be better to have smart cast impossible also here - return x + return x } if (xx is String) { return xx diff --git a/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt b/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt deleted file mode 100644 index 0d7edaeb854..00000000000 --- a/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt +++ /dev/null @@ -1,14 +0,0 @@ -// SUGGESTED_NAMES: i, getKm -// PARAM_TYPES: A -// PARAM_DESCRIPTOR: val a: A defined in test -class A { - -} - -val A.meters: Int? get() = 1 - -fun test() { - val a = A() - if (a.meters == null) return - val km = a.meters / 10 -} \ No newline at end of file diff --git a/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt.after b/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt.after deleted file mode 100644 index 4bc306c2b6d..00000000000 --- a/idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt.after +++ /dev/null @@ -1,16 +0,0 @@ -// SUGGESTED_NAMES: i, getKm -// PARAM_TYPES: A -// PARAM_DESCRIPTOR: val a: A defined in test -class A { - -} - -val A.meters: Int? get() = 1 - -fun test() { - val a = A() - if (a.meters == null) return - val km = i(a) -} - -private fun i(a: A) = a.meters / 10 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java index 3fb972707d9..9b3424c278c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java @@ -504,12 +504,6 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest { doExtractFunctionTest(fileName); } - @TestMetadata("extensionValUnderSmartCast.kt") - public void testExtensionValUnderSmartCast() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/extensionValUnderSmartCast.kt"); - doExtractFunctionTest(fileName); - } - @TestMetadata("extractBlockContent.kt") public void testExtractBlockContent() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/extractBlockContent.kt"); diff --git a/jps-plugin/testData/incremental/pureKotlin/valAddCustomAccessor/build.log b/jps-plugin/testData/incremental/pureKotlin/valAddCustomAccessor/build.log index 19a6d813836..0390b000838 100644 --- a/jps-plugin/testData/incremental/pureKotlin/valAddCustomAccessor/build.log +++ b/jps-plugin/testData/incremental/pureKotlin/valAddCustomAccessor/build.log @@ -12,4 +12,4 @@ Compiling files: src/usage.kt End of files COMPILATION FAILED -Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Int? \ No newline at end of file +Smart cast to 'kotlin.Int' is impossible, because 'a.x' is a member value that has open or custom getter \ No newline at end of file diff --git a/jps-plugin/testData/incremental/pureKotlin/valRemoveCustomAccessor/build.log b/jps-plugin/testData/incremental/pureKotlin/valRemoveCustomAccessor/build.log index 3eb9b489054..d998319baf2 100644 --- a/jps-plugin/testData/incremental/pureKotlin/valRemoveCustomAccessor/build.log +++ b/jps-plugin/testData/incremental/pureKotlin/valRemoveCustomAccessor/build.log @@ -6,7 +6,7 @@ Compiling files: src/usage.kt End of files COMPILATION FAILED -Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Int? +Smart cast to 'kotlin.Int' is impossible, because 'a.x' is a member value that has open or custom getter Cleaning output files: