diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java index 794f997d453..aa68c6a6650 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java @@ -313,7 +313,7 @@ public abstract class StackValue { public static StackValue thisOrOuter(ExpressionCodegen codegen, ClassDescriptor descriptor, boolean isSuper, boolean isExplicit) { // Coerce this/super for traits to support traits with required classes. - // Coerce explicit 'this' for the case when it is smartcasted. + // Coerce explicit 'this' for the case when it is smart cast. // Do not coerce for other classes due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints). boolean coerceType = descriptor.getKind() == ClassKind.TRAIT || (isExplicit && !isSuper); return new ThisOuter(codegen, descriptor, isSuper, coerceType); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/smartcasts/SmartCastUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/smartcasts/SmartCastUtils.java index c98a4f89e67..ded256bef5d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/smartcasts/SmartCastUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/smartcasts/SmartCastUtils.java @@ -152,10 +152,10 @@ public class SmartCastUtils { @NotNull JetExpression expression, @NotNull JetType type, @NotNull BindingTrace trace, - boolean canBeCasted, + boolean canBeCast, boolean recordExpressionType ) { - if (canBeCasted) { + if (canBeCast) { trace.record(SMARTCAST, expression, type); if (recordExpressionType) { //TODO diff --git a/compiler/testData/codegen/box/controlStructures/forInSmartCastedToArray.kt b/compiler/testData/codegen/box/controlStructures/forInSmartCastToArray.kt similarity index 100% rename from compiler/testData/codegen/box/controlStructures/forInSmartCastedToArray.kt rename to compiler/testData/codegen/box/controlStructures/forInSmartCastToArray.kt diff --git a/compiler/testData/codegen/box/typeInfo/implicitSmartCastedThis.kt b/compiler/testData/codegen/box/typeInfo/implicitSmartCastThis.kt similarity index 100% rename from compiler/testData/codegen/box/typeInfo/implicitSmartCastedThis.kt rename to compiler/testData/codegen/box/typeInfo/implicitSmartCastThis.kt diff --git a/compiler/testData/codegen/box/typeInfo/smartCastedThis.kt b/compiler/testData/codegen/box/typeInfo/smartCastThis.kt similarity index 100% rename from compiler/testData/codegen/box/typeInfo/smartCastedThis.kt rename to compiler/testData/codegen/box/typeInfo/smartCastThis.kt diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastedReceiverWithGenerics.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastReceiverWithGenerics.kt similarity index 100% rename from compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastedReceiverWithGenerics.kt rename to compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastReceiverWithGenerics.kt diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastedReceiverWithGenerics.txt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastReceiverWithGenerics.txt similarity index 100% rename from compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastedReceiverWithGenerics.txt rename to compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastReceiverWithGenerics.txt diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index e53ec3a7c4c..e614c46666c 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -7067,9 +7067,9 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("smartCastedReceiverWithGenerics.kt") - public void testSmartCastedReceiverWithGenerics() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastedReceiverWithGenerics.kt"); + @TestMetadata("smartCastReceiverWithGenerics.kt") + public void testSmartCastReceiverWithGenerics() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/smartCastReceiverWithGenerics.kt"); doTest(fileName); } diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java index 809efaf623d..a925f0ddcb9 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -1803,9 +1803,9 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("forInSmartCastedToArray.kt") - public void testForInSmartCastedToArray() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInSmartCastedToArray.kt"); + @TestMetadata("forInSmartCastToArray.kt") + public void testForInSmartCastToArray() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInSmartCastToArray.kt"); doTest(fileName); } @@ -6523,9 +6523,9 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("implicitSmartCastedThis.kt") - public void testImplicitSmartCastedThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/typeInfo/implicitSmartCastedThis.kt"); + @TestMetadata("implicitSmartCastThis.kt") + public void testImplicitSmartCastThis() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/typeInfo/implicitSmartCastThis.kt"); doTest(fileName); } @@ -6553,9 +6553,9 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("smartCastedThis.kt") - public void testSmartCastedThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/typeInfo/smartCastedThis.kt"); + @TestMetadata("smartCastThis.kt") + public void testSmartCastThis() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/typeInfo/smartCastThis.kt"); doTest(fileName); } diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/CastExpressionFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/CastExpressionFix.java index a1f6a7923f7..559d0049245 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/CastExpressionFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/CastExpressionFix.java @@ -69,17 +69,17 @@ public class CastExpressionFix extends JetIntentionAction { @Override public void invoke(@NotNull Project project, Editor editor, JetFile file) throws IncorrectOperationException { JetPsiFactory psiFactory = JetPsiFactory(file); - JetBinaryExpressionWithTypeRHS castedExpression = + JetBinaryExpressionWithTypeRHS castExpression = (JetBinaryExpressionWithTypeRHS) psiFactory.createExpression("(" + element.getText() + ") as " + renderedType); - if (JetPsiUtil.areParenthesesUseless((JetParenthesizedExpression) castedExpression.getLeft())) { - castedExpression = (JetBinaryExpressionWithTypeRHS) psiFactory.createExpression(element.getText() + " as " + renderedType); + if (JetPsiUtil.areParenthesesUseless((JetParenthesizedExpression) castExpression.getLeft())) { + castExpression = (JetBinaryExpressionWithTypeRHS) psiFactory.createExpression(element.getText() + " as " + renderedType); } - JetParenthesizedExpression castedExpressionInParentheses = - (JetParenthesizedExpression) element.replace(psiFactory.createExpression("(" + castedExpression.getText() + ")")); + JetParenthesizedExpression castExpressionInParentheses = + (JetParenthesizedExpression) element.replace(psiFactory.createExpression("(" + castExpression.getText() + ")")); - if (JetPsiUtil.areParenthesesUseless(castedExpressionInParentheses)) { - castedExpressionInParentheses.replace(castedExpression); + if (JetPsiUtil.areParenthesesUseless(castExpressionInParentheses)) { + castExpressionInParentheses.replace(castExpression); } }