diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java index f7d478e6a3b..8d34e1869e0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java @@ -585,7 +585,15 @@ public class JetControlFlowProcessor { accessTarget = getDeclarationAccessTarget(left); } - recordWrite(left, accessTarget, rhsDeferredValue.invoke(), receiverValues, parentExpression); + if (accessTarget == AccessTarget.BlackBox.INSTANCE$ && !(left instanceof JetProperty)) { + generateInstructions(left); + createSyntheticValue(left, MagicKind.VALUE_CONSUMER, left); + } + + PseudoValue rightValue = rhsDeferredValue.invoke(); + PseudoValue rValue = + rightValue != null ? rightValue : createSyntheticValue(parentExpression, MagicKind.UNRECOGNIZED_WRITE_RHS); + builder.write(parentExpression, left, rValue, accessTarget, receiverValues); } private void generateArrayAssignment( @@ -663,24 +671,6 @@ public class JetControlFlowProcessor { return argumentValues; } - private void recordWrite( - @NotNull JetExpression left, - @NotNull AccessTarget target, - @Nullable PseudoValue rightValue, - @NotNull Map receiverValues, - @NotNull JetExpression parentExpression - ) { - if (target == AccessTarget.BlackBox.INSTANCE$) { - List values = ContainerUtil.createMaybeSingletonList(rightValue); - builder.magic(parentExpression, parentExpression, values, defaultTypeMap(values), MagicKind.UNSUPPORTED_ELEMENT); - } - else { - PseudoValue rValue = - rightValue != null ? rightValue : createSyntheticValue(parentExpression, MagicKind.UNRECOGNIZED_WRITE_RHS); - builder.write(parentExpression, left, rValue, target, receiverValues); - } - } - private void generateArrayAccess(JetArrayAccessExpression arrayAccessExpression, @Nullable ResolvedCall resolvedCall) { if (builder.getBoundValue(arrayAccessExpression) != null) return; mark(arrayAccessExpression); diff --git a/compiler/testData/cfg/expressions/assignmentToThis.instructions b/compiler/testData/cfg/expressions/assignmentToThis.instructions index 1252b97f023..c060be35c16 100644 --- a/compiler/testData/cfg/expressions/assignmentToThis.instructions +++ b/compiler/testData/cfg/expressions/assignmentToThis.instructions @@ -9,12 +9,14 @@ L0: magic[FAKE_INITIALIZER](c: C) -> w(c|) 2 mark({ this = c }) - r(c) -> - magic[UNSUPPORTED_ELEMENT](this = c|) -> + r(this, ) -> + magic[VALUE_CONSUMER](this|) -> + r(c) -> + w(this|) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] -===================== \ No newline at end of file + PREV:[, ] +===================== diff --git a/compiler/testData/cfg/expressions/assignmentToThis.values b/compiler/testData/cfg/expressions/assignmentToThis.values index 3121c81908d..491d3789f6e 100644 --- a/compiler/testData/cfg/expressions/assignmentToThis.values +++ b/compiler/testData/cfg/expressions/assignmentToThis.values @@ -4,7 +4,10 @@ fun Int.bar(c: C) { } --------------------- : {<: [ERROR : C]} NEW: magic[FAKE_INITIALIZER](c: C) -> -c : * NEW: r(c) -> -this = c : * NEW: magic[UNSUPPORTED_ELEMENT](this = c|) -> -{ this = c } : * COPY + : * NEW: magic[VALUE_CONSUMER](this|) -> +this : * COPY +this : * NEW: r(this, ) -> +c : * NEW: r(c) -> +this = c !: * +{ this = c } !: * COPY ===================== diff --git a/compiler/testData/cfg/expressions/unresolvedWriteLHS.instructions b/compiler/testData/cfg/expressions/unresolvedWriteLHS.instructions index 7a929be8f3f..c5b37f7f1ff 100644 --- a/compiler/testData/cfg/expressions/unresolvedWriteLHS.instructions +++ b/compiler/testData/cfg/expressions/unresolvedWriteLHS.instructions @@ -6,13 +6,15 @@ fun foo() { L0: 1 2 mark({ x = "" }) + magic[UNRESOLVED_CALL](x) -> + magic[VALUE_CONSUMER](x|) -> mark("") - r("") -> - magic[UNSUPPORTED_ELEMENT](x = ""|) -> + r("") -> + w(x|) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] -===================== \ No newline at end of file + PREV:[, ] +===================== diff --git a/compiler/testData/cfg/expressions/unresolvedWriteLHS.values b/compiler/testData/cfg/expressions/unresolvedWriteLHS.values index 70ca650ecb8..a2c04e03388 100644 --- a/compiler/testData/cfg/expressions/unresolvedWriteLHS.values +++ b/compiler/testData/cfg/expressions/unresolvedWriteLHS.values @@ -3,7 +3,9 @@ fun foo() { x = "" } --------------------- -"" : * NEW: r("") -> -x = "" : * NEW: magic[UNSUPPORTED_ELEMENT](x = ""|) -> -{ x = "" } : * COPY + : * NEW: magic[VALUE_CONSUMER](x|) -> +x : * NEW: magic[UNRESOLVED_CALL](x) -> +"" : * NEW: r("") -> +x = "" !: * +{ x = "" } !: * COPY ===================== diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.kt b/compiler/testData/diagnostics/tests/LValueAssignment.kt index 3cdb597d207..ded49c502fc 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.kt @@ -39,7 +39,7 @@ class D() { fun foo(): Unit {} fun cannotBe() { - var i: Int = 5 + var i: Int = 5 z = 30; "" = ""; @@ -135,4 +135,4 @@ fun Array.checkThis() { abstract class Ab { abstract fun getArray() : Array -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.kt b/compiler/testData/diagnostics/tests/UnusedParameters.kt index a160285e259..17e344f27d5 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.kt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.kt @@ -26,3 +26,7 @@ fun get(p: Any) { fun set(p: Any) { } + +fun foo(s: String) { + s.xxx = 1 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.txt b/compiler/testData/diagnostics/tests/UnusedParameters.txt index d52fc07037f..9ce670bf8e4 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.txt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.txt @@ -1,6 +1,7 @@ package internal fun f(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Int = ...): kotlin.Unit +internal fun foo(/*0*/ s: kotlin.String): kotlin.Unit internal fun get(/*0*/ p: kotlin.Any): kotlin.Unit internal fun set(/*0*/ p: kotlin.Any): kotlin.Unit internal fun kotlin.Any.get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String