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 cd0d1d1b98e..f90b0b6080b 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java
+++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java
@@ -107,15 +107,11 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
@Override
public JetTypeInfo visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression, ExpressionTypingContext context) {
- return visitParenthesizedExpression(expression, context, false);
- }
-
- public JetTypeInfo visitParenthesizedExpression(JetParenthesizedExpression expression, ExpressionTypingContext context, boolean isStatement) {
JetExpression innerExpression = expression.getExpression();
if (innerExpression == null) {
return JetTypeInfo.create(null, context.dataFlowInfo);
}
- return facade.getTypeInfo(innerExpression, context.replaceScope(context.scope), isStatement);
+ return facade.getTypeInfo(innerExpression, context.replaceScope(context.scope));
}
@Override
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java
index 6332572fb8f..2761bc10cb7 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java
+++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java
@@ -415,11 +415,6 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
return components.expressionTypingServices.getBlockReturnedType(expression, context, true);
}
- @Override
- public JetTypeInfo visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression, ExpressionTypingContext context) {
- return basic.visitParenthesizedExpression(expression, context, true);
- }
-
@Override
public JetTypeInfo visitLabeledExpression(@NotNull JetLabeledExpression expression, ExpressionTypingContext context) {
return basic.visitLabeledExpression(expression, context, true);
diff --git a/compiler/testData/codegen/box/labels/labeledDeclarations2.kt b/compiler/testData/codegen/box/labels/labeledDeclarations2.kt
deleted file mode 100644
index 914c9db430d..00000000000
--- a/compiler/testData/codegen/box/labels/labeledDeclarations2.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-data class A(val a: Int, val b: Int)
-
-fun box() : String
-{
- (@a val x = 1)
- (@b fun a() = 2)
- (@c val (z, z2) = A(1, 2))
-
- if (x != 1) return "fail 1"
-
- if (a() != 2) return "fail 2"
-
- if (z != 1 || z2 != 2) return "fail 3"
-
- return "OK"
-}
\ No newline at end of file
diff --git a/compiler/testData/codegen/box/objects/kt560.kt b/compiler/testData/codegen/box/objects/kt560.kt
index 1fe2b9d6477..e246dac3802 100644
--- a/compiler/testData/codegen/box/objects/kt560.kt
+++ b/compiler/testData/codegen/box/objects/kt560.kt
@@ -15,7 +15,7 @@ open class AllEvenNum() {
}
}
- (i = i + 1)
+ i = i + 1
}
}
diff --git a/compiler/testData/diagnostics/tests/BreakContinue.kt b/compiler/testData/diagnostics/tests/BreakContinue.kt
index c44dc157351..fd000c2c7b3 100644
--- a/compiler/testData/diagnostics/tests/BreakContinue.kt
+++ b/compiler/testData/diagnostics/tests/BreakContinue.kt
@@ -1,23 +1,23 @@
class C {
fun f (a : Boolean, b : Boolean) {
- @b (while (true)
+ @b while (true)
@a {
break@f
break
break@b
break@a
- })
+ }
continue
- @b (while (true)
+ @b while (true)
@a {
continue@f
continue
continue@b
continue@a
- })
+ }
break
diff --git a/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt
new file mode 100644
index 00000000000..31e692c4342
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt
@@ -0,0 +1,3 @@
+fun test() {
+ (@d val bar = 2)
+}
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.txt b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.txt
new file mode 100644
index 00000000000..b8def46715c
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.txt
@@ -0,0 +1,3 @@
+package
+
+internal fun test(): kotlin.Unit
diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
index 4c8eefbb73f..90d02fe1376 100644
--- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
+++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java
@@ -3552,6 +3552,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt");
doTest(fileName);
}
+
+ @TestMetadata("ParenthesizedVariable.kt")
+ public void testParenthesizedVariable() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt");
+ doTest(fileName);
+ }
}
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature")
diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java
index ec4ff9a98bb..18c9596182e 100644
--- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java
+++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java
@@ -4317,12 +4317,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
- @TestMetadata("labeledDeclarations2.kt")
- public void testLabeledDeclarations2() throws Exception {
- String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/labels/labeledDeclarations2.kt");
- doTest(fileName);
- }
-
@TestMetadata("propertyAccessor.kt")
public void testPropertyAccessor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/labels/propertyAccessor.kt");
diff --git a/idea/testData/checker/BreakContinue.kt b/idea/testData/checker/BreakContinue.kt
index 593dcc4b57f..d5425ecfc64 100644
--- a/idea/testData/checker/BreakContinue.kt
+++ b/idea/testData/checker/BreakContinue.kt
@@ -1,23 +1,23 @@
class C {
fun f (a : Boolean, b : Boolean) {
- @b (while (true)
+ @b (while (true)
@a {
break@f
break
- break@b
+ break@b
break@a
- })
+ })
continue
- @b (while (true)
+ @b (while (true)
@a {
continue@f
continue
- continue@b
+ continue@b
continue@a
- })
+ })
break
diff --git a/idea/testData/quickfix/suppress/forStatement/afterAssign.kt b/idea/testData/quickfix/suppress/forStatement/afterAssign.kt
index f9c172ef71f..f41ea1c0726 100644
--- a/idea/testData/quickfix/suppress/forStatement/afterAssign.kt
+++ b/idea/testData/quickfix/suppress/forStatement/afterAssign.kt
@@ -1,4 +1,5 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true"
+// ERROR: Assignments are not expressions, and only expressions are allowed in this context
fun foo() {
var x = 0
diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt b/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt
index 439d4526c5e..ced26139263 100644
--- a/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt
+++ b/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt
@@ -1,4 +1,5 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true"
+// ERROR: Assignments are not expressions, and only expressions are allowed in this context
fun foo() {
var x = 0