Rename: casted -> cast
This commit is contained in:
@@ -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);
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,17 +69,17 @@ public class CastExpressionFix extends JetIntentionAction<JetExpression> {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user