diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 6f02ca64ccd..0955ff9f3b1 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -1578,7 +1578,7 @@ public class ExpressionCodegen extends JetVisitor implem for (Iterator iterator = statements.iterator(); iterator.hasNext(); ) { JetExpression possiblyLabeledStatement = iterator.next(); - JetElement statement = JetPsiUtil.safeDeparenthesize(possiblyLabeledStatement, true); + JetElement statement = JetPsiUtil.safeDeparenthesize(possiblyLabeledStatement); if (statement instanceof JetNamedDeclaration) { JetNamedDeclaration declaration = (JetNamedDeclaration) statement; @@ -3693,9 +3693,6 @@ The "returned" value of try expression with no finally is either the last expres public StackValue visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression, StackValue receiver) { JetExpression left = expression.getLeft(); final IElementType opToken = expression.getOperationReference().getReferencedNameElementType(); - if (opToken == JetTokens.COLON) { - return gen(left); - } final JetType rightType = bindingContext.get(TYPE, expression.getRight()); assert rightType != null; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java index 5e6be77c8c7..784a3648e0b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetControlFlowProcessor.java @@ -1203,7 +1203,7 @@ public class JetControlFlowProcessor { IElementType operationType = expression.getOperationReference().getReferencedNameElementType(); JetExpression left = expression.getLeft(); - if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) { + if (operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) { generateInstructions(left); if (getBoundOrUnreachableValue(left) != null) { createNonSyntheticValue(expression, MagicKind.CAST, left); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 9b354ef86ba..a6d8ac3990c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -635,7 +635,6 @@ public interface Errors { DiagnosticFactory1 CANNOT_CHECK_FOR_ERASED = DiagnosticFactory1.create(ERROR); DiagnosticFactory2 UNCHECKED_CAST = DiagnosticFactory2.create(WARNING); - DiagnosticFactory0 DEPRECATED_STATIC_ASSERT = DiagnosticFactory0.create(WARNING, AS_TYPE); DiagnosticFactory0 USELESS_CAST = DiagnosticFactory0.create(WARNING, AS_TYPE); DiagnosticFactory0 CAST_NEVER_SUCCEEDS = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 DYNAMIC_NOT_ALLOWED = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index c21f5b5dace..51a30464d98 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -331,7 +331,6 @@ public class DefaultErrorMessages { MAP.put(ABSTRACT_SUPER_CALL, "Abstract member cannot be accessed directly"); MAP.put(NOT_A_SUPERTYPE, "Not a supertype"); MAP.put(TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER, "Type arguments do not need to be specified in a 'super' qualifier"); - MAP.put(DEPRECATED_STATIC_ASSERT, "Static type assertions are deprecated, consider using a cast instead"); MAP.put(USELESS_CAST, "No cast needed"); MAP.put(CAST_NEVER_SUCCEEDS, "This cast can never succeed"); MAP.put(DYNAMIC_NOT_ALLOWED, "Dynamic types are not allowed in this position"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java b/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java index ab8ccf848ec..65a98753ee1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java @@ -241,7 +241,6 @@ public interface JetTokens { MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, SAFE_ACCESS, ELVIS, // MAP, FILTER, - COLON, RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ, NOT_IN, NOT_IS, IDENTIFIER); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java index 33edb3472ba..cf9afd78d2d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java @@ -148,7 +148,7 @@ public class JetExpressionParsing extends AbstractJetParsing { } }, - COLON_AS(COLON, AS_KEYWORD, AS_SAFE) { + AS(AS_KEYWORD, AS_SAFE) { @Override public JetNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) { parser.myJetParsing.parseTypeRef(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java index 4350983d27e..9f528453cb6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.psi; -import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Lists; import com.intellij.lang.ASTNode; @@ -72,54 +71,14 @@ public class JetPsiUtil { @NotNull public static JetExpression safeDeparenthesize(@NotNull JetExpression expression) { - return safeDeparenthesize(expression, true); - } - - @NotNull - public static JetExpression safeDeparenthesize(@NotNull JetExpression expression, boolean deparenthesizeBinaryExpressionWithTypeRHS) { - JetExpression deparenthesized = deparenthesize(expression, deparenthesizeBinaryExpressionWithTypeRHS); + JetExpression deparenthesized = deparenthesize(expression); return deparenthesized != null ? deparenthesized : expression; } @Nullable - public static JetExpression deparenthesize(@Nullable JetExpression expression) { - return deparenthesize(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ true); - } - - @Nullable - public static JetExpression deparenthesize( - @Nullable JetExpression expression, - boolean deparenthesizeBinaryExpressionWithTypeRHS - ) { - return deparenthesizeWithResolutionStrategy( - expression, deparenthesizeBinaryExpressionWithTypeRHS, /* deparenthesizeRecursively = */ null); - } - - @Nullable - public static JetExpression deparenthesizeOnce( - @Nullable JetExpression expression, - boolean deparenthesizeBinaryExpressionWithTypeRHS - ) { - return deparenthesizeOnce(expression, deparenthesizeBinaryExpressionWithTypeRHS, null); - } - - @Nullable - public static JetExpression deparenthesizeWithResolutionStrategy( - @Nullable JetExpression expression, - @Nullable Function typeResolutionStrategy - ) { - return deparenthesizeWithResolutionStrategy(expression, true, typeResolutionStrategy); - } - - @Nullable - private static JetExpression deparenthesizeWithResolutionStrategy( - @Nullable JetExpression expression, - boolean deparenthesizeBinaryExpressionWithTypeRHS, - @Nullable Function typeResolutionStrategy - ) { + public static JetExpression deparenthesize(@Nullable JetExpression expression ) { while (true) { - JetExpression baseExpression = - deparenthesizeOnce(expression, deparenthesizeBinaryExpressionWithTypeRHS, typeResolutionStrategy); + JetExpression baseExpression = deparenthesizeOnce(expression); if (baseExpression == expression) return baseExpression; expression = baseExpression; @@ -127,24 +86,10 @@ public class JetPsiUtil { } @Nullable - private static JetExpression deparenthesizeOnce( - @Nullable JetExpression expression, - boolean deparenthesizeBinaryExpressionWithTypeRHS, - @Nullable Function typeResolutionStrategy + public static JetExpression deparenthesizeOnce( + @Nullable JetExpression expression ) { - if (deparenthesizeBinaryExpressionWithTypeRHS && expression instanceof JetBinaryExpressionWithTypeRHS) { - JetBinaryExpressionWithTypeRHS binaryExpression = (JetBinaryExpressionWithTypeRHS) expression; - JetSimpleNameExpression operationSign = binaryExpression.getOperationReference(); - if (JetTokens.COLON.equals(operationSign.getReferencedNameElementType())) { - JetTypeReference typeReference = binaryExpression.getRight(); - if (typeResolutionStrategy != null && typeReference != null) { - typeResolutionStrategy.apply(typeReference); - } - return binaryExpression.getLeft(); - } - return expression; - } - else if (expression instanceof JetAnnotatedExpression) { + if (expression instanceof JetAnnotatedExpression) { return ((JetAnnotatedExpression) expression).getBaseExpression(); } else if (expression instanceof JetLabeledExpression) { @@ -893,7 +838,7 @@ public class JetPsiUtil { @Nullable JetExpression expression, @NotNull StatementFilter statementFilter ) { - JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesize(expression, false); + JetExpression deparenthesizedExpression = deparenthesize(expression); if (deparenthesizedExpression instanceof JetBlockExpression) { JetBlockExpression blockExpression = (JetBlockExpression) deparenthesizedExpression; // todo diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java index 8f4ab87ecb4..01edbd5b875 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java @@ -133,7 +133,7 @@ public class DelegatedPropertyResolver { return psiFactory.createExpression(builtIns.getPropertyMetadataImpl().getName().asString() + "(\"" + propertyDescriptor.getName().asString() + - "\"): " + + "\") as " + builtIns.getPropertyMetadata().getName().asString()); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt index 69ceeb4917f..2d8ba239f55 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt @@ -45,7 +45,7 @@ import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.expressions.DataFlowAnalyzer -import java.util.ArrayList +import java.util.* public class CallCompleter( private val argumentTypeResolver: ArgumentTypeResolver, @@ -297,7 +297,7 @@ public class CallCompleter( if ((!ErrorUtils.containsErrorType(recordedType) && recordedType == updatedType) || updatedType == null) return updatedType fun deparenthesizeOrGetSelector(expression: JetExpression?): JetExpression? { - val deparenthesized = JetPsiUtil.deparenthesizeOnce(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ false) + val deparenthesized = JetPsiUtil.deparenthesizeOnce(expression) if (deparenthesized != expression) return deparenthesized if (expression is JetQualifiedExpression) return expression.getSelectorExpression() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.java index 7e5e7b27971..3b7edcaf838 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.java @@ -443,7 +443,7 @@ public class CallExpressionResolver { ) { if (qualifierReceiver == null) return; JetExpression calleeExpression = - JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()), false); + JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression())); DeclarationDescriptor selectorDescriptor = calleeExpression instanceof JetReferenceExpression ? context.trace.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression) : null; 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 094a2e09567..b22abe61293 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt @@ -365,7 +365,7 @@ public class CandidateResolver( expectedType: JetType, actualType: JetType, context: ResolutionContext<*>): JetType? { - val receiverToCast = ExpressionReceiver(JetPsiUtil.safeDeparenthesize(expression, false), actualType) + val receiverToCast = ExpressionReceiver(JetPsiUtil.safeDeparenthesize(expression), actualType) val variants = smartCastManager.getSmartCastVariantsExcludingReceiver(context, receiverToCast) for (possibleType in variants) { if (JetTypeChecker.DEFAULT.isSubtypeOf(possibleType, expectedType)) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt index de4c154a4b0..e883fceae85 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt @@ -186,7 +186,7 @@ class DynamicCallableDescriptors(private val builtIns: KotlinBuiltIns) { val varargElementType: JetType? var hasSpreadOperator = false - val argExpression = JetPsiUtil.deparenthesize(arg.getArgumentExpression(), false) + val argExpression = JetPsiUtil.deparenthesize(arg.getArgumentExpression()) when { argExpression is JetFunctionLiteralExpression -> { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt index fe16da9d9d3..84c15b2f025 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt @@ -90,7 +90,7 @@ private fun List.filterArgsInParentheses() = filter { it !is Jet public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueArgument? { fun JetElement.deparenthesizeStructurally(): JetElement? { - val deparenthesized = if (this is JetExpression) JetPsiUtil.deparenthesizeOnce(this, false) else this + val deparenthesized = if (this is JetExpression) JetPsiUtil.deparenthesizeOnce(this) else this return when { deparenthesized != this -> deparenthesized this is JetFunctionLiteralExpression -> this.getFunctionLiteral() @@ -105,7 +105,7 @@ public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueA // Get call / resolved call from binding context public fun JetElement?.getCalleeExpressionIfAny(): JetExpression? { - val element = if (this is JetExpression) JetPsiUtil.deparenthesize(this, false) else this + val element = if (this is JetExpression) JetPsiUtil.deparenthesize(this) else this return when (element) { is JetSimpleNameExpression -> element is JetCallElement -> element.getCalleeExpression() @@ -127,8 +127,8 @@ public fun JetElement.getCall(context: BindingContext): Call? { if (element == null) return null val parent = element.getParent() - val reference = when { - parent is JetInstanceExpressionWithLabel -> parent : JetInstanceExpressionWithLabel + val reference: JetExpression? = when { + parent is JetInstanceExpressionWithLabel -> parent parent is JetUserType -> parent.getParent()?.getParent() as? JetConstructorCalleeExpression else -> element.getCalleeExpressionIfAny() } 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 86ad600f7ca..f6dcac401e6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -172,17 +172,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { TypeResolutionContext typeResolutionContext = new TypeResolutionContext(context.scope, context.trace, true, allowBareTypes); PossiblyBareType possiblyBareTarget = components.typeResolver.resolvePossiblyBareType(typeResolutionContext, right); - if (operationType == JetTokens.COLON) { - // We do not allow bare types on static assertions, because static assertions provide an expected type for their argument, - // thus causing a circularity in type dependencies - assert !possiblyBareTarget.isBare() : "Bare types should not be allowed for static assertions, because argument inference makes no sense there"; - JetType targetType = possiblyBareTarget.getActualType(); - - JetTypeInfo typeInfo = facade.getTypeInfo(left, contextWithNoExpectedType.replaceExpectedType(targetType)); - checkBinaryWithTypeRHS(expression, context, targetType, typeInfo.getType()); - return components.dataFlowAnalyzer.checkType(typeInfo.replaceType(targetType), expression, context); - } - JetTypeInfo typeInfo = facade.getTypeInfo(left, contextWithNoExpectedType); JetType subjectType = typeInfo.getType(); @@ -210,10 +199,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { if (actualType == null) return; JetSimpleNameExpression operationSign = expression.getOperationReference(); IElementType operationType = operationSign.getReferencedNameElementType(); - if (operationType == JetTokens.COLON) { - context.trace.report(DEPRECATED_STATIC_ASSERT.on(expression)); - return; - } if (operationType != JetTokens.AS_KEYWORD && operationType != JetTokens.AS_SAFE) { context.trace.report(UNSUPPORTED.on(operationSign, "binary operation with type RHS")); return; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java index 9e149b875e5..7d0d86895e2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java @@ -211,7 +211,7 @@ public class DataFlowAnalyzer { hasError.set(false); } - JetExpression expression = JetPsiUtil.safeDeparenthesize(expressionToCheck, false); + JetExpression expression = JetPsiUtil.safeDeparenthesize(expressionToCheck); recordExpectedType(c.trace, expression, c.expectedType); if (expressionType == null) return null; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java index 130ae3e5fa5..c99d6204271 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java @@ -224,7 +224,7 @@ public class ExpressionTypingUtils { } public static boolean dependsOnExpectedType(@Nullable JetExpression expression) { - JetExpression expr = JetPsiUtil.deparenthesize(expression, false); + JetExpression expr = JetPsiUtil.deparenthesize(expression); if (expr == null) return false; if (expr instanceof JetBinaryExpressionWithTypeRHS) { 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 5a099318842..c80ae6507b3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.types.expressions; -import com.google.common.base.Function; import com.google.common.collect.Sets; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; @@ -51,7 +50,7 @@ import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPac import java.util.Collection; import static org.jetbrains.kotlin.diagnostics.Errors.*; -import static org.jetbrains.kotlin.psi.JetPsiUtil.deparenthesizeWithResolutionStrategy; +import static org.jetbrains.kotlin.psi.JetPsiUtil.deparenthesize; import static org.jetbrains.kotlin.resolve.BindingContext.AMBIGUOUS_REFERENCE_TARGET; import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE_REASSIGNMENT; import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT; @@ -246,7 +245,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito JetType leftType = leftInfo.getType(); JetExpression right = expression.getRight(); - JetExpression left = leftOperand == null ? null : JetPsiUtil.deparenthesize(leftOperand); + JetExpression left = leftOperand == null ? null : deparenthesize(leftOperand); if (right == null || left == null) { temporary.commit(); return leftInfo.clearType(); @@ -341,13 +340,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito scope, ((JetAnnotatedExpression) leftOperand).getAnnotationEntries(), context.trace ); } - JetExpression left = deparenthesizeWithResolutionStrategy(leftOperand, new Function() { - @Override - public Void apply(JetTypeReference reference) { - components.typeResolver.resolveType(context.scope, reference, context.trace, true); - return null; - } - }); + JetExpression left = deparenthesize(leftOperand); JetExpression right = expression.getRight(); if (left instanceof JetArrayAccessExpression) { JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LabelResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LabelResolver.java index 93646a35206..dfd8682453a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LabelResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LabelResolver.java @@ -87,7 +87,7 @@ public class LabelResolver { @NotNull private JetExpression getExpressionUnderLabel(@NotNull JetExpression labeledExpression) { - JetExpression expression = JetPsiUtil.safeDeparenthesize(labeledExpression, true); + JetExpression expression = JetPsiUtil.safeDeparenthesize(labeledExpression); if (expression instanceof JetFunctionLiteralExpression) { return ((JetFunctionLiteralExpression) expression).getFunctionLiteral(); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/PatternMatchingTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/PatternMatchingTypingVisitor.java index 8a25b0c67b2..654e1d91458 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/PatternMatchingTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/PatternMatchingTypingVisitor.java @@ -93,7 +93,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor { assert subjectType != null; if (TypeUtils.isNullableType(subjectType) && !WhenChecker.containsNullCase(expression, context.trace)) { ExpressionTypingContext subjectContext = context.replaceExpectedType(TypeUtils.makeNotNullable(subjectType)); - components.dataFlowAnalyzer.checkPossibleCast(subjectType, JetPsiUtil.safeDeparenthesize(subjectExpression, false), subjectContext); + components.dataFlowAnalyzer.checkPossibleCast(subjectType, JetPsiUtil.safeDeparenthesize(subjectExpression), subjectContext); } context = context.replaceDataFlowInfo(typeInfo.getDataFlowInfo()); } diff --git a/compiler/testData/cfg/expressions/casts.instructions b/compiler/testData/cfg/expressions/casts.instructions index 37eb376d56e..a2d86b1c92c 100644 --- a/compiler/testData/cfg/expressions/casts.instructions +++ b/compiler/testData/cfg/expressions/casts.instructions @@ -1,6 +1,5 @@ == foo == fun foo(a: Any) { - a : String a as String a as? String } @@ -10,20 +9,17 @@ L0: v(a: Any) magic[FAKE_INITIALIZER](a: Any) -> w(a|) - 2 mark({ a : String a as String a as? String }) - mark(a : String) - r(a) -> - magic[CAST](a : String|) -> + 2 mark({ a as String a as? String }) mark(a as String) - r(a) -> - magic[CAST](a as String|) -> + r(a) -> + magic[CAST](a as String|) -> mark(a as? String) - r(a) -> - magic[CAST](a as? String|) -> + r(a) -> + magic[CAST](a as? String|) -> L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] -===================== \ No newline at end of file + PREV:[, ] +===================== diff --git a/compiler/testData/cfg/expressions/casts.kt b/compiler/testData/cfg/expressions/casts.kt index bca0f907b05..00322322907 100644 --- a/compiler/testData/cfg/expressions/casts.kt +++ b/compiler/testData/cfg/expressions/casts.kt @@ -1,5 +1,4 @@ fun foo(a: Any) { - a : String a as String a as? String } \ No newline at end of file diff --git a/compiler/testData/cfg/expressions/casts.values b/compiler/testData/cfg/expressions/casts.values index ea9f97f7838..51c16a96f95 100644 --- a/compiler/testData/cfg/expressions/casts.values +++ b/compiler/testData/cfg/expressions/casts.values @@ -1,16 +1,13 @@ == foo == fun foo(a: Any) { - a : String a as String a as? String } --------------------- - : {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> -a : * NEW: r(a) -> -a : String : * NEW: magic[CAST](a : String|) -> -a : * NEW: r(a) -> -a as String : * NEW: magic[CAST](a as String|) -> -a : * NEW: r(a) -> -a as? String : * NEW: magic[CAST](a as? String|) -> -{ a : String a as String a as? String } : * COPY + : {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> +a : * NEW: r(a) -> +a as String : * NEW: magic[CAST](a as String|) -> +a : * NEW: r(a) -> +a as? String : * NEW: magic[CAST](a as? String|) -> +{ a as String a as? String } : * COPY ===================== \ No newline at end of file diff --git a/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt b/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt index 6d03b1f1f6e..227bd67042c 100644 --- a/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt +++ b/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt @@ -15,8 +15,11 @@ class E : C(), D fun box(): String { val e = E() if (e.foo() != 222) return "Fail 1" - if ((e : D).foo() != 222) return "Fail 2" - if ((e : C).foo() != 222) return "Fail 3" - if ((e : A).foo() != 222) return "Fail 4" + val d: D = e + val c: C = e + val a: A = e + if (d.foo() != 222) return "Fail 2" + if (c.foo() != 222) return "Fail 3" + if (a.foo() != 222) return "Fail 4" return "OK" } diff --git a/compiler/testData/codegen/box/bridges/complexTraitImpl.kt b/compiler/testData/codegen/box/bridges/complexTraitImpl.kt index ce91d13f080..ff38790023b 100644 --- a/compiler/testData/codegen/box/bridges/complexTraitImpl.kt +++ b/compiler/testData/codegen/box/bridges/complexTraitImpl.kt @@ -20,9 +20,13 @@ class E : D, C() fun box(): String { val e = E() var r = e.foo()[0] - r += (e : D).foo().iterator().next() - r += (e : C).foo()[0] - r += (e : B).foo()[0] - r += (e : A).foo()[0] + val d: D = e + val c: C = e + val b: B = e + val a: A = e + r += d.foo().iterator().next() + r += c.foo()[0] + r += b.foo()[0] + r += a.foo()[0] return if (r == "BBBBB") "OK" else "Fail: $r" } diff --git a/compiler/testData/codegen/box/bridges/delegation.kt b/compiler/testData/codegen/box/bridges/delegation.kt index d0dd7aa00f0..29dfbecf8a6 100644 --- a/compiler/testData/codegen/box/bridges/delegation.kt +++ b/compiler/testData/codegen/box/bridges/delegation.kt @@ -8,4 +8,7 @@ class B : A { class C(a: A) : A by a -fun box() = (C(B()) : A).foo() +fun box(): String { + val a: A = C(B()) + return a.foo() +} diff --git a/compiler/testData/codegen/box/bridges/delegationProperty.kt b/compiler/testData/codegen/box/bridges/delegationProperty.kt index 768f010140f..8192c4f4532 100644 --- a/compiler/testData/codegen/box/bridges/delegationProperty.kt +++ b/compiler/testData/codegen/box/bridges/delegationProperty.kt @@ -11,5 +11,5 @@ fun box(): String { val b: A = B(o) b.result = "OK" if (b.result != "OK") return "Fail" - return (b : A).result + return b.result } diff --git a/compiler/testData/codegen/box/bridges/diamond.kt b/compiler/testData/codegen/box/bridges/diamond.kt index b1ea60973a5..ef1990bf937 100644 --- a/compiler/testData/codegen/box/bridges/diamond.kt +++ b/compiler/testData/codegen/box/bridges/diamond.kt @@ -13,11 +13,14 @@ class Z : B, C { fun box(): String { val z = Z() + val c: C = z + val b: B = z + val a: A = z return when { - z.foo("", 0) != "Z" -> "Fail #1" - (z : C).foo("", 0) != "Z" -> "Fail #2" - (z : B).foo("", 0) != "Z" -> "Fail #3" - (z : A).foo("", 0) != "Z" -> "Fail #4" + z.foo("", 0) != "Z" -> "Fail #1" + c.foo("", 0) != "Z" -> "Fail #2" + b.foo("", 0) != "Z" -> "Fail #3" + a.foo("", 0) != "Z" -> "Fail #4" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt b/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt index 822954327ea..ed98372c3ff 100644 --- a/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt +++ b/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt @@ -13,14 +13,18 @@ class Z2 : B, A fun box(): String { val z1 = Z1() val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 return when { - z1.foo( 0) != "B" -> "Fail #1" - (z1 : A).foo( 0) != "B" -> "Fail #2" - (z1 : B).foo( 0) != "B" -> "Fail #3" - z2.foo( 0) != "B" -> "Fail #4" - (z2 : A).foo( 0) != "B" -> "Fail #5" - (z2 : B).foo( 0) != "B" -> "Fail #6" + z1.foo( 0) != "B" -> "Fail #1" + z1a.foo( 0) != "B" -> "Fail #2" + z1b.foo( 0) != "B" -> "Fail #3" + z2.foo( 0) != "B" -> "Fail #4" + z2a.foo( 0) != "B" -> "Fail #5" + z2b.foo( 0) != "B" -> "Fail #6" else -> "OK" } } \ No newline at end of file diff --git a/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt b/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt index 73a3d93682b..69751512658 100644 --- a/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt +++ b/compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt @@ -13,14 +13,18 @@ class Z2 : B, A fun box(): String { val z1 = Z1() val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 return when { - z1.foo( 0) != "B" -> "Fail #1" - (z1 : A).foo( 0) != "B" -> "Fail #2" - (z1 : B).foo( 0) != "B" -> "Fail #3" - z2.foo( 0) != "B" -> "Fail #4" - (z2 : A).foo( 0) != "B" -> "Fail #5" - (z2 : B).foo( 0) != "B" -> "Fail #6" + z1.foo( 0) != "B" -> "Fail #1" + z1a.foo( 0) != "B" -> "Fail #2" + z1b.foo( 0) != "B" -> "Fail #3" + z2.foo( 0) != "B" -> "Fail #4" + z2a.foo( 0) != "B" -> "Fail #5" + z2b.foo( 0) != "B" -> "Fail #6" else -> "OK" } } \ No newline at end of file diff --git a/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt b/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt index 584d1ce3da3..ffff9f297e4 100644 --- a/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt +++ b/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt @@ -12,8 +12,9 @@ class Foo: Class(), Trait { } fun box(): String { + val t: Trait = Foo() try { - (Foo() : Trait).f() + t.f() } catch (e: UnsupportedOperationException) { return "OK" } diff --git a/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt b/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt index e794fa46083..450ad185175 100644 --- a/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt +++ b/compiler/testData/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt @@ -15,14 +15,18 @@ class Z2 : B by Z(), A fun box(): String { val z1 = Z1() val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 return when { - z1.foo( 0) != "B" -> "Fail #1" - (z1 : A).foo( 0) != "B" -> "Fail #2" - (z1 : B).foo( 0) != "B" -> "Fail #3" - z2.foo( 0) != "B" -> "Fail #4" - (z2 : A).foo( 0) != "B" -> "Fail #5" - (z2 : B).foo( 0) != "B" -> "Fail #6" + z1.foo( 0) != "B" -> "Fail #1" + z1a.foo( 0) != "B" -> "Fail #2" + z1b.foo( 0) != "B" -> "Fail #3" + z2.foo( 0) != "B" -> "Fail #4" + z2a.foo( 0) != "B" -> "Fail #5" + z2b.foo( 0) != "B" -> "Fail #6" else -> "OK" } } \ No newline at end of file diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt b/compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt index 78126d2ac93..eed49f27531 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt @@ -17,7 +17,9 @@ class C : A, B() fun box(): String { val c = C() c.foo = "1" - (c : B).foo = "2" - (c : A).foo = "3" + val b: B = c + val a: A = c + b.foo = "2" + a.foo = "3" return if (result == "123") "OK" else "Fail: $result" } diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt b/compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt index 1f023aad5ba..7827f53a892 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt @@ -21,8 +21,11 @@ class D4 : D3 fun box(): String { val x = D4() x.foo() - (x : D3).foo() - (x : F2).foo() - (x : D1).foo() + val d3: D3 = x + val f2: F2 = x + val d1: D1 = x + d3.foo() + f2.foo() + d1.foo() return if (result == "D3D3D3D3") "OK" else "Fail: $result" } diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt b/compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt index 843f133922b..4e1231396fa 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt @@ -11,8 +11,10 @@ class C : A, B fun box(): String { val c = C() var result = "" + val b: B = c + val a: A = c result += c.foo() - result += (c : B).foo() - result += (c : A).foo() + result += b.foo() + result += a.foo() return if (result == "AAA") "OK" else "Fail: $result" } diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt b/compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt index 461f1b25c8b..c9844928db7 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt @@ -17,9 +17,14 @@ class F5 : F3, D4() fun box(): String { val z = F5() var result = z.foo() - result += (z : D4).foo() - result += (z : F3).foo() as Int - result += (z : D2).foo() as Int - result += (z : D1).foo() as Int + val d4: D4 = z + val f3: F3 = z + val d2: D2 = z + val d1: D1 = z + + result += d4.foo() + result += f3.foo() as Int + result += d2.foo() as Int + result += d1.foo() as Int return if (result == 5 * 42) "OK" else "Fail: $result" } diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt b/compiler/testData/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt index 09a3d921613..075bbca0443 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt @@ -10,7 +10,9 @@ class C(value: String) : A(value), B fun box(): String { val c = C("OK") - if ((c : B).component1() != "OK") return "Fail 1" - if ((c : A).component1() != "OK") return "Fail 2" + val b: B = c + val a: A = c + if (b.component1() != "OK") return "Fail 1" + if (a.component1() != "OK") return "Fail 2" return c.component1() } diff --git a/compiler/testData/codegen/box/bridges/kt2498.kt b/compiler/testData/codegen/box/bridges/kt2498.kt index 715caf3b011..b50fd235d56 100644 --- a/compiler/testData/codegen/box/bridges/kt2498.kt +++ b/compiler/testData/codegen/box/bridges/kt2498.kt @@ -13,7 +13,9 @@ fun box(): String { val myStringList = StringList() myStringList.add("first element") if (myStringList.get(0) != "StringList.get()") return "Fail #1" - if ((myStringList: BaseStringList).get(0) != "StringList.get()") return "Fail #2" - if ((myStringList: ArrayList).get(0) != "StringList.get()") return "Fail #3" + val b: BaseStringList = myStringList + val a: ArrayList = myStringList + if (b.get(0) != "StringList.get()") return "Fail #2" + if (a.get(0) != "StringList.get()") return "Fail #3" return "OK" } diff --git a/compiler/testData/codegen/box/bridges/kt318.kt b/compiler/testData/codegen/box/bridges/kt318.kt index f454d01992d..72e5991297c 100644 --- a/compiler/testData/codegen/box/bridges/kt318.kt +++ b/compiler/testData/codegen/box/bridges/kt318.kt @@ -18,6 +18,7 @@ class B : A { fun box(): String { val b = B() b.foo(Child()) - (b : A).foo(Child()) + val a: A = b + a.foo(Child()) return if (result == "BB") "OK" else "Fail: $result" } diff --git a/compiler/testData/codegen/box/bridges/longChainOneBridge.kt b/compiler/testData/codegen/box/bridges/longChainOneBridge.kt index 4f47fe333e1..6d1d79c28e7 100644 --- a/compiler/testData/codegen/box/bridges/longChainOneBridge.kt +++ b/compiler/testData/codegen/box/bridges/longChainOneBridge.kt @@ -17,12 +17,16 @@ class Z : D() { fun box(): String { val z = Z() + val d: D = z + val c: C = z + val b: B = z + val a: A = z return when { - z.foo("") != "Z" -> "Fail #1" - (z : D).foo("") != "Z" -> "Fail #2" - (z : C).foo("") != "Z" -> "Fail #3" - (z : B).foo("") != "Z" -> "Fail #4" - (z : A).foo("") != "Z" -> "Fail #5" + z.foo("") != "Z" -> "Fail #1" + d.foo("") != "Z" -> "Fail #2" + c.foo("") != "Z" -> "Fail #3" + b.foo("") != "Z" -> "Fail #4" + a.foo("") != "Z" -> "Fail #5" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt b/compiler/testData/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt index c66feefd1d2..82306ddf3f4 100644 --- a/compiler/testData/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt +++ b/compiler/testData/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt @@ -13,11 +13,14 @@ class Z : C() { fun box(): String { val z = Z() + val c: C = z + val b: B = z + val a: A = z return when { - z.foo("", 0, 0.0) != "Z" -> "Fail #1" - (z : C).foo("", 0, 0.0) != "Z" -> "Fail #2" - (z : B).foo("", 0, 0.0) != "Z" -> "Fail #3" - (z : A).foo("", 0, 0.0) != "Z" -> "Fail #4" + z.foo("", 0, 0.0) != "Z" -> "Fail #1" + c.foo("", 0, 0.0) != "Z" -> "Fail #2" + b.foo("", 0, 0.0) != "Z" -> "Fail #3" + a.foo("", 0, 0.0) != "Z" -> "Fail #4" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/methodFromTrait.kt b/compiler/testData/codegen/box/bridges/methodFromTrait.kt index 46bbf4e80fb..058109901d1 100644 --- a/compiler/testData/codegen/box/bridges/methodFromTrait.kt +++ b/compiler/testData/codegen/box/bridges/methodFromTrait.kt @@ -8,9 +8,10 @@ class Z : A { fun box(): String { val z = Z() + val a: A = z return when { - z.foo(0, 0) != "Z" -> "Fail #1" - (z : A).foo(0, 0) != "Z" -> "Fail #2" + z.foo(0, 0) != "Z" -> "Fail #1" + a.foo(0, 0) != "Z" -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt b/compiler/testData/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt index 6a4fa135a71..0b1ada081fc 100644 --- a/compiler/testData/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt +++ b/compiler/testData/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt @@ -16,7 +16,9 @@ class C : B { fun box(): String { val c = C() var r = c.foo().iterator().next() - r += (c : B).foo().iterator().next() - r += (c : A).foo().iterator().next() + val b: B = c + val a: A = c + r += b.foo().iterator().next() + r += a.foo().iterator().next() return if (r == "CCC") "OK" else "Fail: $r" } diff --git a/compiler/testData/codegen/box/bridges/objectClone.kt b/compiler/testData/codegen/box/bridges/objectClone.kt index 266bd90f610..773f66e04c4 100644 --- a/compiler/testData/codegen/box/bridges/objectClone.kt +++ b/compiler/testData/codegen/box/bridges/objectClone.kt @@ -13,7 +13,8 @@ fun box(): String { "Fail 1" } catch (e: AssertionError) { try { - (B() : HashSet).clone() + val hs: HashSet = B() + hs.clone() "Fail 2" } catch (e: AssertionError) { "OK" diff --git a/compiler/testData/codegen/box/bridges/simple.kt b/compiler/testData/codegen/box/bridges/simple.kt index 80a996ec6d4..284d7cbb44c 100644 --- a/compiler/testData/codegen/box/bridges/simple.kt +++ b/compiler/testData/codegen/box/bridges/simple.kt @@ -9,9 +9,10 @@ class Z : A() { fun box(): String { val z = Z() + val a: A = z return when { - z.foo("") != "Z" -> "Fail #1" - (z : A).foo("") != "Z" -> "Fail #2" + z.foo("") != "Z" -> "Fail #1" + a.foo("") != "Z" -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleEnum.kt b/compiler/testData/codegen/box/bridges/simpleEnum.kt index fa164e0b42d..f92436fe96f 100644 --- a/compiler/testData/codegen/box/bridges/simpleEnum.kt +++ b/compiler/testData/codegen/box/bridges/simpleEnum.kt @@ -11,10 +11,10 @@ enum class Z(val name: String) : A { fun box(): String { return when { - Z.Z1.foo("") != "Z1" -> "Fail #1" - Z.Z2.foo("") != "Z2" -> "Fail #2" - (Z.Z1 : A).foo("") != "Z1" -> "Fail #3" - (Z.Z2 : A).foo("") != "Z2" -> "Fail #4" + Z.Z1.foo("") != "Z1" -> "Fail #1" + Z.Z2.foo("") != "Z2" -> "Fail #2" + (Z.Z1 as A).foo("") != "Z1" -> "Fail #3" + (Z.Z2 as A).foo("") != "Z2" -> "Fail #4" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleGenericMethod.kt b/compiler/testData/codegen/box/bridges/simpleGenericMethod.kt index 95ef4de467c..81e6c8607c1 100644 --- a/compiler/testData/codegen/box/bridges/simpleGenericMethod.kt +++ b/compiler/testData/codegen/box/bridges/simpleGenericMethod.kt @@ -9,9 +9,10 @@ class Z : A() { fun box(): String { val z = Z() + val a: A = z return when { - z.foo("", 0) != "Z" -> "Fail #1" - (z : A).foo("", 0) != "Z" -> "Fail #2" + z.foo("", 0) != "Z" -> "Fail #1" + a.foo("", 0) != "Z" -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleObject.kt b/compiler/testData/codegen/box/bridges/simpleObject.kt index 6f378c9deda..5ff3c8177e6 100644 --- a/compiler/testData/codegen/box/bridges/simpleObject.kt +++ b/compiler/testData/codegen/box/bridges/simpleObject.kt @@ -11,11 +11,13 @@ fun box(): String { val z = object : A() { override fun foo(t: String) = "z" } + val az: A = Z + val a: A = z return when { - Z.foo("") != "Z" -> "Fail #1" - z.foo("") != "z" -> "Fail #2" - (Z : A).foo("") != "Z" -> "Fail #3" - (z : A).foo("") != "z" -> "Fail #4" + Z.foo("") != "Z" -> "Fail #1" + z.foo("") != "z" -> "Fail #2" + az.foo("") != "Z" -> "Fail #3" + a.foo("") != "z" -> "Fail #4" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleReturnType.kt b/compiler/testData/codegen/box/bridges/simpleReturnType.kt index d00af1d3913..ffd0bf84892 100644 --- a/compiler/testData/codegen/box/bridges/simpleReturnType.kt +++ b/compiler/testData/codegen/box/bridges/simpleReturnType.kt @@ -8,9 +8,10 @@ class Z : A(17) { fun box(): String { val z = Z() + val a: A = z return when { - z.foo() != 239 -> "Fail #1" - (z : A).foo() != 239 -> "Fail #2" + z.foo() != 239 -> "Fail #1" + a.foo() != 239 -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleTraitImpl.kt b/compiler/testData/codegen/box/bridges/simpleTraitImpl.kt index 4d2a723aaad..1e1ccbab17e 100644 --- a/compiler/testData/codegen/box/bridges/simpleTraitImpl.kt +++ b/compiler/testData/codegen/box/bridges/simpleTraitImpl.kt @@ -7,9 +7,10 @@ class Z : A fun box(): String { val z = Z() + val a: A = z return when { - z.foo("") != "A" -> "Fail #1" - (z : A).foo("") != "A" -> "Fail #2" + z.foo("") != "A" -> "Fail #1" + a.foo("") != "A" -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/simpleUpperBound.kt b/compiler/testData/codegen/box/bridges/simpleUpperBound.kt index eb57d12065e..dea1f7eb647 100644 --- a/compiler/testData/codegen/box/bridges/simpleUpperBound.kt +++ b/compiler/testData/codegen/box/bridges/simpleUpperBound.kt @@ -9,9 +9,10 @@ class Z : A() { fun box(): String { val z = Z() + val a: A = z return when { - z.foo(0) != "Z" -> "Fail #1" - (z : A).foo(0) != "Z" -> "Fail #2" + z.foo(0) != "Z" -> "Fail #1" + a.foo(0) != "Z" -> "Fail #2" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt index 6c658283d1f..39e1b1935f0 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt @@ -11,10 +11,12 @@ class Z : B() { fun box(): String { val z = Z() + val b: B = z + val a: A = z return when { - z.foo("") != "Z" -> "Fail #1" - (z : B).foo("") != "Z" -> "Fail #2" - (z : A).foo("") != "Z" -> "Fail #3" + z.foo("") != "Z" -> "Fail #1" + b.foo("") != "Z" -> "Fail #2" + a.foo("") != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt index 2b6015812f7..3db4852ed2b 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt @@ -10,10 +10,12 @@ class Z : B() { fun box(): String { val z = Z() + val b: B = z + val a: A = z return when { - z.foo(0, 0) != "Z" -> "Fail #1" - (z : B).foo(0, 0) != "Z" -> "Fail #2" - (z : A).foo(0, 0) != "Z" -> "Fail #3" + z.foo(0, 0) != "Z" -> "Fail #1" + b.foo(0, 0) != "Z" -> "Fail #2" + a.foo(0, 0) != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/delegation.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/delegation.kt index ae0d6317dfe..3d80f6523ea 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/delegation.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/delegation.kt @@ -13,5 +13,6 @@ class D : A by C() fun box(): String { val d = D() if (d.id("") != "") return "Fail" - return (d : A).id("OK") + val a: A = d + return a.id("OK") } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/enum.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/enum.kt index 50b575ff44e..e6d1fa46caf 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/enum.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/enum.kt @@ -12,13 +12,17 @@ enum class Z(val name: String) : B { fun box(): String { + val z1b: B = Z.Z1 + val z2b: B = Z.Z2 + val z1a: A = Z.Z1 + val z2a: A = Z.Z2 return when { - Z.Z1.foo("") != "Z1" -> "Fail #1" - Z.Z2.foo("") != "Z2" -> "Fail #2" - (Z.Z1 : B).foo("") != "Z1" -> "Fail #3" - (Z.Z2 : B).foo("") != "Z2" -> "Fail #4" - (Z.Z1 : A).foo("") != "Z1" -> "Fail #5" - (Z.Z2 : A).foo("") != "Z2" -> "Fail #6" + Z.Z1.foo("") != "Z1" -> "Fail #1" + Z.Z2.foo("") != "Z2" -> "Fail #2" + z1b.foo("") != "Z1" -> "Fail #3" + z2b.foo("") != "Z2" -> "Fail #4" + z1a.foo("") != "Z1" -> "Fail #5" + z2a.foo("") != "Z2" -> "Fail #6" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt index ee22fb3ca43..0119eba58a8 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt @@ -11,10 +11,12 @@ class Z : B() { fun box(): String { val z = Z() + val b: B = z + val a: A = z return when { - z.foo("", 0) != "Z" -> "Fail #1" - (z : B).foo("", 0) != "Z" -> "Fail #2" - (z : A).foo("", 0) != "Z" -> "Fail #3" + z.foo("", 0) != "Z" -> "Fail #1" + b.foo("", 0) != "Z" -> "Fail #2" + a.foo("", 0) != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/object.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/object.kt index 6e436d0c724..c7c95464c59 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/object.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/object.kt @@ -13,13 +13,18 @@ fun box(): String { val o = object : B() { override fun foo(t: String) = "o" } + val zb: B = Z + val ob: B = o + val za: A = Z + val oa: A = o + return when { - Z.foo("") != "Z" -> "Fail #1" - o.foo("") != "o" -> "Fail #2" - (Z : B).foo("") != "Z" -> "Fail #3" - (o : B).foo("") != "o" -> "Fail #4" - (Z : A).foo("") != "Z" -> "Fail #5" - (o : A).foo("") != "o" -> "Fail #6" + Z.foo("") != "Z" -> "Fail #1" + o.foo("") != "o" -> "Fail #2" + zb.foo("") != "Z" -> "Fail #3" + ob.foo("") != "o" -> "Fail #4" + za.foo("") != "Z" -> "Fail #5" + oa.foo("") != "o" -> "Fail #6" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/property.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/property.kt index ff9dc1f5906..21208405891 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/property.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/property.kt @@ -9,4 +9,7 @@ class Z : B() { } -fun box() = (Z() : A).foo +fun box(): String { + val a: A = Z() + return a.foo +} diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/simple.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/simple.kt index dae5c4c0f33..c6c2637ef22 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/simple.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/simple.kt @@ -11,10 +11,12 @@ class Z : B() { fun box(): String { val z = Z() + val b: B = z + val a: A = z return when { - z.foo("") != "Z" -> "Fail #1" - (z : B).foo("") != "Z" -> "Fail #2" - (z : A).foo("") != "Z" -> "Fail #3" + z.foo("") != "Z" -> "Fail #1" + b.foo("") != "Z" -> "Fail #2" + a.foo("") != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/upperBound.kt b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/upperBound.kt index ae908934eba..f6d4dccfc40 100644 --- a/compiler/testData/codegen/box/bridges/substitutionInSuperClass/upperBound.kt +++ b/compiler/testData/codegen/box/bridges/substitutionInSuperClass/upperBound.kt @@ -11,10 +11,12 @@ class Z : B() { fun box(): String { val z = Z() + val b: B = z + val a: A = z return when { - z.foo(0) != "Z" -> "Fail #1" - (z : B).foo(0) != "Z" -> "Fail #2" - (z : A).foo(0) != "Z" -> "Fail #3" + z.foo(0) != "Z" -> "Fail #1" + b.foo(0) != "Z" -> "Fail #2" + a.foo(0) != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt b/compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt index 93d02c7fa93..ec0cf44081a 100644 --- a/compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt +++ b/compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt @@ -10,6 +10,8 @@ class C : B fun box(): String { val c = C() - var r = c.foo() + (c : B).foo() + (c : A).foo() + val b: B = c + val a: A = c + var r = c.foo() + b.foo() + a.foo() return if (r == "BBB") "OK" else "Fail: $r" } diff --git a/compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt b/compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt index ba08200e6f2..38d7cb2431f 100644 --- a/compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt +++ b/compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt @@ -17,13 +17,17 @@ class Z2 : B, A { fun box(): String { val z1 = Z1() val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 return when { - z1.foo("", 0) != "Z1" -> "Fail #1" - (z1 : A).foo("", 0) != "Z1" -> "Fail #2" - (z1 : B).foo("", 0) != "Z1" -> "Fail #3" - z2.foo("", 0) != "Z2" -> "Fail #4" - (z2 : A).foo("", 0) != "Z2" -> "Fail #5" - (z2 : B).foo("", 0) != "Z2" -> "Fail #6" + z1.foo("", 0) != "Z1" -> "Fail #1" + z1a.foo("", 0) != "Z1" -> "Fail #2" + z1b.foo("", 0) != "Z1" -> "Fail #3" + z2.foo("", 0) != "Z2" -> "Fail #4" + z2a.foo("", 0) != "Z2" -> "Fail #5" + z2b.foo("", 0) != "Z2" -> "Fail #6" else -> "OK" } } diff --git a/compiler/testData/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt b/compiler/testData/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt index 21ffaa75e18..de57467d8b1 100644 --- a/compiler/testData/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt +++ b/compiler/testData/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt @@ -13,10 +13,12 @@ class Z : A, B { fun box(): String { val z = Z() + val a: A = z + val b: B = z return when { - z.foo(0) != "Z" -> "Fail #1" - (z : A).foo(0) != "Z" -> "Fail #2" - (z : B).foo(0) != "Z" -> "Fail #3" + z.foo(0) != "Z" -> "Fail #1" + a.foo(0) != "Z" -> "Fail #2" + b.foo(0) != "Z" -> "Fail #3" else -> "OK" } } diff --git a/compiler/testData/codegen/box/closures/enclosingThis.kt b/compiler/testData/codegen/box/closures/enclosingThis.kt index c04dd822152..787a4d89e4a 100644 --- a/compiler/testData/codegen/box/closures/enclosingThis.kt +++ b/compiler/testData/codegen/box/closures/enclosingThis.kt @@ -4,7 +4,7 @@ class Point(val x:Int, val y:Int) { } } -val m = Point(2, 3).mul() : (scalar:Int)->Point +val m = Point(2, 3).mul() fun box() : String { val answer = m(5) diff --git a/compiler/testData/codegen/box/intrinsics/incWithLabel.kt b/compiler/testData/codegen/box/intrinsics/incWithLabel.kt index 5eea76e2c10..fff72ffb135 100644 --- a/compiler/testData/codegen/box/intrinsics/incWithLabel.kt +++ b/compiler/testData/codegen/box/intrinsics/incWithLabel.kt @@ -2,9 +2,7 @@ fun box(): String { var x = 1 (foo@ x)++ ++(foo@ x) - (x: Int)++ - ++(x: Int) - if (x != 5) return "Fail: $x" + if (x != 3) return "Fail: $x" return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/box/primitiveTypes/kt4098.kt b/compiler/testData/codegen/box/primitiveTypes/kt4098.kt index 35f50f497fe..a74f18feeac 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt4098.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt4098.kt @@ -1,5 +1,5 @@ fun box(): String { - val c = '0': Char? + val c: Char? = '0' c!!.toInt() "123456"?.get(0)!!.toInt() diff --git a/compiler/testData/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt b/compiler/testData/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt index 66bd59b3fd3..a9273088e10 100644 --- a/compiler/testData/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt +++ b/compiler/testData/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt @@ -1,6 +1,6 @@ fun box(): String { try { - if ((null : Int?)!! == 10) return "Fail #1" + if ((null as Int?)!! == 10) return "Fail #1" return "Fail #2" } catch (e: Exception) { diff --git a/compiler/testData/codegen/box/properties/kt1714_minimal.kt b/compiler/testData/codegen/box/properties/kt1714_minimal.kt index e453069c4ad..faec0d99269 100644 --- a/compiler/testData/codegen/box/properties/kt1714_minimal.kt +++ b/compiler/testData/codegen/box/properties/kt1714_minimal.kt @@ -7,6 +7,7 @@ class AImpl : A { } public fun box() : String { - (AImpl() : A).v + val a: A = AImpl() + a.v return "OK" } diff --git a/compiler/testData/codegen/box/regressions/kt4281.kt b/compiler/testData/codegen/box/regressions/kt4281.kt index ff5af0bfef5..a1e84ddff49 100644 --- a/compiler/testData/codegen/box/regressions/kt4281.kt +++ b/compiler/testData/codegen/box/regressions/kt4281.kt @@ -2,7 +2,8 @@ abstract class C { fun test(x: Int) { if (x == 0) return if (this is D) { - (this: D).test(x - 1) + val d: D = this + d.test(x - 1) } } } diff --git a/compiler/testData/codegen/box/unit/nullableUnit.kt b/compiler/testData/codegen/box/unit/nullableUnit.kt index 12abddc9695..335dd498319 100644 --- a/compiler/testData/codegen/box/unit/nullableUnit.kt +++ b/compiler/testData/codegen/box/unit/nullableUnit.kt @@ -14,7 +14,7 @@ fun box(): String { val y = x if (!isNullGeneric(y)) return "Fail 3" - if (!deepIsNull((null : Unit?) ?: null)) return "Fail 4" + if (!deepIsNull(x ?: null)) return "Fail 4" return "OK" } diff --git a/compiler/testData/codegen/box/vararg/kt6192.kt b/compiler/testData/codegen/box/vararg/kt6192.kt index 1c75e53a2e6..bd9b8f93a7d 100644 --- a/compiler/testData/codegen/box/vararg/kt6192.kt +++ b/compiler/testData/codegen/box/vararg/kt6192.kt @@ -50,8 +50,8 @@ fun box(): String { val aZ = BooleanArray(3) - if (barB(*aB, 23: Byte).size() != 4) return "fail: Byte" - if (barB(11: Byte, *aB, 23: Byte, *aB).size() != 8) return "fail: Byte" + if (barB(*aB, 23.toByte()).size() != 4) return "fail: Byte" + if (barB(11.toByte(), *aB, 23.toByte(), *aB).size() != 8) return "fail: Byte" if (barC(*aC, 'A').size() != 4) return "fail: Char" if (barC('A', *aC, 'A', *aC).size() != 8) return "fail: Char" @@ -80,11 +80,11 @@ fun box(): String { if (concatParameters(*aI, 7, 8, *bI) != "1237845") return "fail: concatParameters 6" if (concatParameters(*aI, 7, *bI, *aI, 9) != "1237451239") return "fail: concatParameters 7" - if (barJ(*aJ, 23: Long).size() != 4) return "fail: Long" - if (barJ(*aJ, 23: Long, *aJ, *aJ).size() != 10) return "fail: Long" + if (barJ(*aJ, 23L).size() != 4) return "fail: Long" + if (barJ(*aJ, 23L, *aJ, *aJ).size() != 10) return "fail: Long" - if (barS(*aS, 23: Short).size() != 4) return "fail: Short" - if (barS(*aS, *aS, 23: Short, *aS).size() != 10) return "fail: Short" + if (barS(*aS, 23.toShort()).size() != 4) return "fail: Short" + if (barS(*aS, *aS, 23.toShort(), *aS).size() != 10) return "fail: Short" if (barZ(*aZ, true).size() != 4) return "fail: Boolean" if (barZ(false, *aZ, true, *aZ).size() != 8) return "fail: Boolean" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt index 619f4dd047e..86a9dfa1b8c 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt @@ -1,7 +1,8 @@ fun box(): String { val sub = Sub() + val sup: Super = sub - (sub : Super).foo{ } + sup.foo{ } if (sub.lastCalled != "super") { return "FAIL: ${sub.lastCalled} instead of super" } diff --git a/compiler/testData/codegen/boxWithStdlib/arrays/cloneArray.kt b/compiler/testData/codegen/boxWithStdlib/arrays/cloneArray.kt index 214798f5958..f0b493a9608 100644 --- a/compiler/testData/codegen/boxWithStdlib/arrays/cloneArray.kt +++ b/compiler/testData/codegen/boxWithStdlib/arrays/cloneArray.kt @@ -2,14 +2,12 @@ import java.util.Arrays.equals fun box(): String { val s = arrayOf("live", "long") - val t = s.clone() - t : Array + val t: Array = s.clone() if (!equals(s, t)) return "Fail string" if (s identityEquals t) return "Fail string identity" val ss = arrayOf(s, s) - val tt = ss.clone() - tt : Array> + val tt: Array> = ss.clone() if (!equals(ss, tt)) return "Fail string[]" if (ss identityEquals tt) return "Fail string[] identity" diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt index f55d18f0020..7309c8133d8 100644 --- a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt @@ -18,11 +18,11 @@ fun box() : String { b[0] = 1 assertEquals(1, b[0]) - val x = 1 : Int? + val x: Int? = 1 assertEquals(1, x!!.hashCode()) - val y = 1000 : Int? - val z = 1000 : Int? + val y: Int? = 1000 + val z: Int? = 1000 val res = y.identityEquals(z) val c1: Any = if (1 == 1) 0 else "abc" diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt index c1989011177..662f7227096 100644 --- a/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt @@ -13,11 +13,11 @@ fun foo() { val b = arrayOfNulls(4) b[100] = 5 - val x = 6 : Int? + val x: Int? = 6 val hc = x!!.hashCode() - val y = 7 : Int? - val z = 8 : Int? + val y: Int? = 7 + val z: Int? = 8 val res = y.identityEquals(z) val c1: Any = if (1 == 1) 0 else "abc" diff --git a/compiler/testData/codegen/bytecodeText/prefixIntVarIncrement.kt b/compiler/testData/codegen/bytecodeText/prefixIntVarIncrement.kt index aad196027db..13e5070405f 100644 --- a/compiler/testData/codegen/bytecodeText/prefixIntVarIncrement.kt +++ b/compiler/testData/codegen/bytecodeText/prefixIntVarIncrement.kt @@ -2,8 +2,6 @@ fun main(args: Array) { var i = 10 ++i ++(l@ i) - ++(i: Int) - ++(l@ (i: Int)) } -// 4 IINC \ No newline at end of file +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/controlStructures/tryCatch.kt b/compiler/testData/codegen/controlStructures/tryCatch.kt index ae8790a1b4f..dc27d309d4a 100644 --- a/compiler/testData/codegen/controlStructures/tryCatch.kt +++ b/compiler/testData/codegen/controlStructures/tryCatch.kt @@ -4,6 +4,6 @@ fun foo(s: String): String? { return "no message"; } catch(e: NumberFormatException) { - return (e : Throwable).getMessage(); // Work around an overload-resolution bug + return e.getMessage(); // Work around an overload-resolution bug } } diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt index da18f76b658..891ebc148d8 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt @@ -3,7 +3,7 @@ fun foo(varargs f var bar : Int = 1 set(varargs v) {} -val x : (Int) -> Int = {@varargs x : Int -> x} +val x : (Int) -> Int = {@varargs x : Int -> x} class Hello(varargs args: Any) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt index 98563b46f9b..9cd17e933f4 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt @@ -6,7 +6,7 @@ fun foo(@test f : Int) {} var bar : Int = 1 set(@test v) {} -val x : (Int) -> Int = {@test x : Int -> x} // todo fix parser annotation on lambda parameter +val x : (Int) -> Int = {@test x : Int -> x} // todo fix parser annotation on lambda parameter class Hello(@test args: Any) { } diff --git a/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.kt b/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.kt deleted file mode 100644 index ca63802eb61..00000000000 --- a/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.kt +++ /dev/null @@ -1,5 +0,0 @@ -package t - -fun foo(array: Array) { - (array[0] : Int) = 22 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.txt b/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.txt deleted file mode 100644 index 4f3d9fb1ee2..00000000000 --- a/compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.txt +++ /dev/null @@ -1,5 +0,0 @@ -package - -package t { - public fun foo(/*0*/ array: kotlin.Array): kotlin.Unit -} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt index 2856038971f..e82ac4530de 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt @@ -1,21 +1,21 @@ val receiver = { Int.() -> } val receiverWithParameter = { Int.(a) -> } -val receiverAndReturnType = { Int.(): Int -> 5 } -val receiverAndReturnTypeWithParameter = { Int.(a: Int): Int -> 5 } +val receiverAndReturnType = { Int.(): Int -> 5 } +val receiverAndReturnTypeWithParameter = { Int.(a: Int): Int -> 5 } -val returnType = { (): Int -> 5 } -val returnTypeWithParameter = { (b: Int): Int -> 5 } +val returnType = { (): Int -> 5 } +val returnTypeWithParameter = { (b: Int): Int -> 5 } val receiverWithFunctionType = { ((Int) -> Int).() -> } -val parenthesizedParameters = { (a: Int) -> } +val parenthesizedParameters = { (a: Int) -> } val parenthesizedParameters2 = { (b) -> } val none = { -> } -val parameterWithFunctionType = { a: ((Int) -> Int) -> } // todo fix parser +val parameterWithFunctionType = { a: ((Int) -> Int) -> } // todo fix parser val newSyntax = { a: Int -> } val newSyntax1 = { a, b -> } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.txt b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.txt index 9adea8f484f..c67674aff11 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.txt +++ b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.txt @@ -6,13 +6,13 @@ public val newSyntax2: (kotlin.Int, kotlin.Int) -> kotlin.Unit public val newSyntax3: (???, kotlin.Int) -> kotlin.Unit public val newSyntax4: (kotlin.Int, ???) -> kotlin.Unit public val none: () -> kotlin.Unit -public val parameterWithFunctionType: () -> ((kotlin.Int) -> kotlin.Int) -> [ERROR : No type element] -public val parenthesizedParameters: () -> kotlin.Int +public val parameterWithFunctionType: () -> ??? +public val parenthesizedParameters: () -> ??? public val parenthesizedParameters2: () -> ??? public val receiver: () -> ??? -public val receiverAndReturnType: () -> kotlin.Int -public val receiverAndReturnTypeWithParameter: () -> kotlin.Int +public val receiverAndReturnType: () -> ??? +public val receiverAndReturnTypeWithParameter: () -> ??? public val receiverWithFunctionType: () -> kotlin.Int.Companion public val receiverWithParameter: () -> ??? -public val returnType: () -> kotlin.Int -public val returnTypeWithParameter: () -> kotlin.Int +public val returnType: () -> ??? +public val returnTypeWithParameter: () -> ??? diff --git a/compiler/testData/diagnostics/tests/suppress/allWarnings/suppressWarningsOnExpression.kt b/compiler/testData/diagnostics/tests/suppress/allWarnings/suppressWarningsOnExpression.kt index d6e4aa84b65..609b38cd708 100644 --- a/compiler/testData/diagnostics/tests/suppress/allWarnings/suppressWarningsOnExpression.kt +++ b/compiler/testData/diagnostics/tests/suppress/allWarnings/suppressWarningsOnExpression.kt @@ -1,4 +1,4 @@ fun foo() { @Suppress("warnings") - ("": String??) + ("" as String??) } \ No newline at end of file diff --git a/compiler/testData/psi/NewLinesValidOperations.kt b/compiler/testData/psi/NewLinesValidOperations.kt index 7d4c30511cc..61c0425d745 100644 --- a/compiler/testData/psi/NewLinesValidOperations.kt +++ b/compiler/testData/psi/NewLinesValidOperations.kt @@ -9,10 +9,6 @@ fun test() { ?.length - str - - : String - str as String diff --git a/compiler/testData/psi/NewLinesValidOperations.txt b/compiler/testData/psi/NewLinesValidOperations.txt index 71c6fc2bb9a..a834a045ef5 100644 --- a/compiler/testData/psi/NewLinesValidOperations.txt +++ b/compiler/testData/psi/NewLinesValidOperations.txt @@ -41,18 +41,6 @@ JetFile: NewLinesValidOperations.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('length') PsiWhiteSpace('\n\n ') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('str') - PsiWhiteSpace('\n\n ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiWhiteSpace('\n\n ') BINARY_WITH_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('str') diff --git a/compiler/testData/psi/Precedence.kt b/compiler/testData/psi/Precedence.kt index 70a5fcc23cf..bf52e412109 100644 --- a/compiler/testData/psi/Precedence.kt +++ b/compiler/testData/psi/Precedence.kt @@ -26,15 +26,12 @@ fun foo() { 1 foo 2 ?: 1 bar 3 a b c d e f g a ?: b in b?: c - (a : b) < b : c a < b == b > c a != b && c a || b && c a = b -> c a = b || c - t : Any - t : Any? t as Any? t as Any.Any.Any t as () -> T @@ -42,17 +39,10 @@ fun foo() { t as? Any.Any.Any t as? () -> T - t : Any * 1 - t : Any? * 1 t as Any? * 1 t as Any.Any.Any * 1 t as () -> T * 1 t as? Any? * 1 t as? Any.Any.Any * 1 t as? () -> T * 1 - - ++t : Any + 1 - a.b : Any + 1 - - (t : Any) * 1 } diff --git a/compiler/testData/psi/Precedence.txt b/compiler/testData/psi/Precedence.txt index 057fa84ba04..15f7452ad1d 100644 --- a/compiler/testData/psi/Precedence.txt +++ b/compiler/testData/psi/Precedence.txt @@ -576,37 +576,6 @@ JetFile: Precedence.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') PsiWhiteSpace('\n ') - BINARY_EXPRESSION - PARENTHESIZED - PsiElement(LPAR)('(') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(LT)('<') - PsiWhiteSpace(' ') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiWhiteSpace('\n ') BINARY_EXPRESSION BINARY_EXPRESSION REFERENCE_EXPRESSION @@ -697,32 +666,6 @@ JetFile: Precedence.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') PsiWhiteSpace('\n\n ') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiWhiteSpace('\n ') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiElement(QUEST)('?') - PsiWhiteSpace('\n ') BINARY_WITH_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('t') @@ -879,46 +822,6 @@ JetFile: Precedence.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace('\n\n ') - BINARY_EXPRESSION - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(MUL)('*') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiElement(QUEST)('?') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(MUL)('*') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n ') BINARY_EXPRESSION BINARY_WITH_TYPE REFERENCE_EXPRESSION @@ -1116,72 +1019,5 @@ JetFile: Precedence.kt PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n\n ') - BINARY_EXPRESSION - BINARY_WITH_TYPE - PREFIX_EXPRESSION - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUS)('+') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - BINARY_WITH_TYPE - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUS)('+') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n\n ') - BINARY_EXPRESSION - PARENTHESIZED - PsiElement(LPAR)('(') - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('t') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Any') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(MUL)('*') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/Properties.kt b/compiler/testData/psi/Properties.kt index c8d2ab95d00..295639da061 100644 --- a/compiler/testData/psi/Properties.kt +++ b/compiler/testData/psi/Properties.kt @@ -44,7 +44,6 @@ val foo.bar = 5 fun foo() { val foo = 5 get() = 5 - set(int : x) = 5 } val IList.lastIndex : Int diff --git a/compiler/testData/psi/Properties.txt b/compiler/testData/psi/Properties.txt index 4bee4077a86..3d3080c992b 100644 --- a/compiler/testData/psi/Properties.txt +++ b/compiler/testData/psi/Properties.txt @@ -338,32 +338,6 @@ JetFile: Properties.kt PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('5') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('int') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('5') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n') diff --git a/compiler/testData/psi/annotation/at/primaryConstructor.kt b/compiler/testData/psi/annotation/at/primaryConstructor.kt index 69142b77086..7e23830724e 100644 --- a/compiler/testData/psi/annotation/at/primaryConstructor.kt +++ b/compiler/testData/psi/annotation/at/primaryConstructor.kt @@ -5,5 +5,4 @@ class A2 @Ann2("")(x: Int) : B { class A3 @[Ann3] private @(x: Int) class A4 @[Ann4] @private @(x: Int) -class A5 private @Ann4(x: Int) : B class A6 @[Ann5] @private @ @[Ann6]() diff --git a/compiler/testData/psi/annotation/at/primaryConstructor.txt b/compiler/testData/psi/annotation/at/primaryConstructor.txt index ba6bbf2182c..5fa62350c15 100644 --- a/compiler/testData/psi/annotation/at/primaryConstructor.txt +++ b/compiler/testData/psi/annotation/at/primaryConstructor.txt @@ -150,48 +150,6 @@ JetFile: primaryConstructor.kt PsiElement(IDENTIFIER)('Int') PsiElement(RPAR)(')') PsiWhiteSpace('\n') - CLASS - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('A5') - PsiWhiteSpace(' ') - PRIMARY_CONSTRUCTOR - MODIFIER_LIST - PsiElement(private)('private') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - PsiElement(AT)('@') - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Ann4') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') - PsiErrorElement:Expecting 'constructor' keyword - - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - DELEGATION_SPECIFIER_LIST - DELEGATOR_SUPER_CLASS - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiWhiteSpace('\n') CLASS PsiElement(class)('class') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/greatSyntacticShift/nullableTypes.kt b/compiler/testData/psi/greatSyntacticShift/nullableTypes.kt index a85a83b810e..e8af5174bea 100644 --- a/compiler/testData/psi/greatSyntacticShift/nullableTypes.kt +++ b/compiler/testData/psi/greatSyntacticShift/nullableTypes.kt @@ -1,6 +1,5 @@ fun test() { x as? X ?: return - x as? X? : return x as X? ?: return X?::x diff --git a/compiler/testData/psi/greatSyntacticShift/nullableTypes.txt b/compiler/testData/psi/greatSyntacticShift/nullableTypes.txt index 427410192b8..af2dcb105e0 100644 --- a/compiler/testData/psi/greatSyntacticShift/nullableTypes.txt +++ b/compiler/testData/psi/greatSyntacticShift/nullableTypes.txt @@ -33,28 +33,6 @@ JetFile: nullableTypes.kt RETURN PsiElement(return)('return') PsiWhiteSpace('\n ') - BINARY_WITH_TYPE - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(AS_SAFE)('as?') - PsiWhiteSpace(' ') - TYPE_REFERENCE - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('X') - PsiElement(QUEST)('?') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - PsiElement(return)('return') - PsiWhiteSpace('\n ') BINARY_EXPRESSION BINARY_WITH_TYPE REFERENCE_EXPRESSION diff --git a/compiler/testData/resolve/Projections.resolve b/compiler/testData/resolve/Projections.resolve index 36e50736a23..449219ea108 100644 --- a/compiler/testData/resolve/Projections.resolve +++ b/compiler/testData/resolve/Projections.resolve @@ -17,40 +17,40 @@ class Inv() { fun testInOut() { In().`In.f:T->Unit`f("1"); - (return : In).`In.f:T->Unit`f("1"); - (return : In).`In.f:Int->Int`f("1") - (return : In<*>).`In.f:Int->Int`f("1"); + (return as In).`In.f:T->Unit`f("1"); + (return as In).`In.f:Int->Int`f("1") + (return as In<*>).`In.f:Int->Int`f("1"); In().`In.f:Int->Int`f(1); - (return : In).`In.f:Int->Int`f(1); - (return : In).`In.f:Int->Int`f(1) - (return : In).`!`f1(1) - (return : In<*>).`In.f:Int->Int`f(1); + (return as In).`In.f:Int->Int`f(1); + (return as In).`In.f:Int->Int`f(1) + (return as In).`!`f1(1) + (return as In<*>).`In.f:Int->Int`f(1); Out().`Out.f(a)`f(1) - (return : Out).`Out.f(a)`f(1) - (return : Out).`Out.f(a)`f(1) - (return : Out<*>).`Out.f(a)`f(1) + (return as Out).`Out.f(a)`f(1) + (return as Out).`Out.f(a)`f(1) + (return as Out<*>).`Out.f(a)`f(1) Out().`Out.f`f() - (return : Out).`Out.f`f() - (return : Out).`Out.f`f() - (return : Out<*>).`Out.f`f() + (return as Out).`Out.f`f() + (return as Out).`Out.f`f() + (return as Out<*>).`Out.f`f() Inv().`Inv.f`f(1) - (return : Inv).`Inv.f`f(1) - (return : Inv).`!`f(1) - (return : Inv<*>).`!`f(1) + (return as Inv).`Inv.f`f(1) + (return as Inv).`!`f(1) + (return as Inv<*>).`!`f(1) Inv().`Inv.inf`inf(1) - (return : Inv).`Inv.inf`inf(1) - (return : Inv).`!`inf(1) - (return : Inv<*>).`!`inf(1) + (return as Inv).`Inv.inf`inf(1) + (return as Inv).`!`inf(1) + (return as Inv<*>).`!`inf(1) Inv().`Inv.outf`outf() - ((return : Inv).`Inv.outf`outf())`:kotlin::Any` - (return : Inv).`Inv.outf`outf() - (return : Inv<*>).`Inv.outf`outf() + ((return as Inv).`Inv.outf`outf())`:kotlin::Any` + (return as Inv).`Inv.outf`outf() + (return as Inv<*>).`Inv.outf`outf() Inv().`Inv.outf`outf(1) } \ No newline at end of file diff --git a/compiler/testData/resolve/ResolveToJava2.resolve b/compiler/testData/resolve/ResolveToJava2.resolve index 5f368d4abf8..800d39717fb 100644 --- a/compiler/testData/resolve/ResolveToJava2.resolve +++ b/compiler/testData/resolve/ResolveToJava2.resolve @@ -8,8 +8,8 @@ import java.`java::java.util`util.* fun t(t : T) : T { `c`c(java.lang.Integer(1)) System.out.`java::java.io.PrintStream.print(Object)`print(t) - System.out.`java::java.io.PrintStream.print(char[])`print(null : CharArray) - System.out.`java::java.io.PrintStream.print(Object)`print(null : Object?) + System.out.`java::java.io.PrintStream.print(char[])`print(null as CharArray?) + System.out.`java::java.io.PrintStream.print(Object)`print(null as Object?) System.out.`java::java.io.PrintStream.print(Int)`print(1) System.out.`java::java.io.PrintStream.print(Double)`print(1.0) } diff --git a/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.kt b/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.kt index 06bb337a103..a593202fb29 100644 --- a/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.kt +++ b/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.kt @@ -22,16 +22,3 @@ annotation class Primitives( boolean = true ) class C - -@Primitives( - byte = 7: Byte, - char = '%': Char, - short = 239: Short, - int = 239017: Int, - long = 123456789123456789L: Long, - float = 2.72f: Float, - double = -3.14: Double, - boolean = true: Boolean -) -class D - diff --git a/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.txt b/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.txt index b3b9a42db34..1876bc4aff2 100644 --- a/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.txt +++ b/compiler/testData/serialization/builtinsSerializer/annotationArguments/primitives.txt @@ -4,10 +4,6 @@ package test public constructor C() } -@test.Primitives(boolean = true, byte = 7.toByte(), char = \u0025 ('%'), double = -3.14.toDouble(), float = 2.72.toFloat(), int = 239017, long = 123456789123456789.toLong(), short = 239.toShort()) public final class D { - public constructor D() -} - @kotlin.annotation.annotation() public final class Primitives : kotlin.Annotation { public constructor Primitives(/*0*/ byte: kotlin.Byte, /*1*/ char: kotlin.Char, /*2*/ short: kotlin.Short, /*3*/ int: kotlin.Int, /*4*/ long: kotlin.Long, /*5*/ float: kotlin.Float, /*6*/ double: kotlin.Double, /*7*/ boolean: kotlin.Boolean) public final val boolean: kotlin.Boolean diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 6e3273c9031..d3d74d5c149 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -4578,12 +4578,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("ArrayAccessAssignment.kt") - public void testArrayAccessAssignment() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/ArrayAccessAssignment.kt"); - doTest(fileName); - } - @TestMetadata("checkDeparenthesizedType.kt") public void testCheckDeparenthesizedType() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java b/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java index 6d3c2393709..72e9d34d2a3 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java @@ -403,7 +403,7 @@ public class JetTypeCheckerTest extends JetLiteFixture { assertType("Props().p", "Int"); assertType("Props().p.p", "Int"); - assertType("(return : Props).p", "Any?"); + assertType("(return as Props).p", "Any?"); } public void testOverloads() throws Exception { @@ -444,18 +444,18 @@ public class JetTypeCheckerTest extends JetLiteFixture { assertType("'1'.minus(1)", "Char"); assertType("'1'.minus('1')", "Int"); - assertType("(1:Short).plus(1.toDouble())", "Double"); - assertType("(1:Short).plus(1.toFloat())", "Float"); - assertType("(1:Short).plus(1.toLong())", "Long"); - assertType("(1:Short).plus(1)", "Int"); - assertType("(1:Short).plus(1:Short)", "Int"); + assertType("(1.toShort()).plus(1.toDouble())", "Double"); + assertType("(1.toShort()).plus(1.toFloat())", "Float"); + assertType("(1.toShort()).plus(1.toLong())", "Long"); + assertType("(1.toShort()).plus(1)", "Int"); + assertType("(1.toShort()).plus(1.toShort())", "Int"); - assertType("(1:Byte).plus(1.toDouble())", "Double"); - assertType("(1:Byte).plus(1.toFloat())", "Float"); - assertType("(1:Byte).plus(1.toLong())", "Long"); - assertType("(1:Byte).plus(1)", "Int"); - assertType("(1:Byte).plus(1:Short)", "Int"); - assertType("(1:Byte).plus(1:Byte)", "Int"); + assertType("(1.toByte()).plus(1.toDouble())", "Double"); + assertType("(1.toByte()).plus(1.toFloat())", "Float"); + assertType("(1.toByte()).plus(1.toLong())", "Long"); + assertType("(1.toByte()).plus(1)", "Int"); + assertType("(1.toByte()).plus(1.toShort())", "Int"); + assertType("(1.toByte()).plus(1.toByte())", "Int"); assertType("\"1\".plus(1.toDouble())", "String"); assertType("\"1\".plus(1.toFloat())", "String"); diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index 532969f16c0..6f03ef904e2 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -253,7 +253,7 @@ public abstract class LazyJavaScope( c.components.externalSignatureResolver.reportSignatureErrors(propertyDescriptor, signatureErrors) } - propertyDescriptor.setType(effectiveSignature.getReturnType(), listOf(), getDispatchReceiverParameter(), null : JetType?) + propertyDescriptor.setType(effectiveSignature.getReturnType(), listOf(), getDispatchReceiverParameter(), null as JetType?) if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.getType())) { propertyDescriptor.setCompileTimeInitializer( diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt index 2476e43c6e9..e3e7840aea3 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt @@ -25,12 +25,13 @@ import java.lang.reflect.TypeVariable public class ReflectJavaClassifierType(public override val type: Type) : ReflectJavaType(), JavaClassifierType { private val classifier: JavaClassifier = run { val type = type - when (type) { + val classifier: JavaClassifier = when (type) { is Class<*> -> ReflectJavaClass(type) is TypeVariable<*> -> ReflectJavaTypeParameter(type) is ParameterizedType -> ReflectJavaClass(type.getRawType() as Class<*>) else -> throw IllegalStateException("Not a classifier type (${type.javaClass}): $type") - } : JavaClassifier + } + classifier } override fun getClassifier(): JavaClassifier = classifier diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt index 99d85acdb81..f56892acd90 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt @@ -53,7 +53,7 @@ private fun TypeArgument.toTypeProjection(): TypeProjection { } private fun TypeProjection.toTypeArgument(typeParameter: TypeParameterDescriptor) = - when (TypeSubstitutor.combine(typeParameter.getVariance(), getProjectionKind()) : Variance) { + when (TypeSubstitutor.combine(typeParameter.getVariance(), getProjectionKind())) { Variance.INVARIANT -> TypeArgument(typeParameter, getType(), getType()) Variance.IN_VARIANCE -> TypeArgument(typeParameter, getType(), typeParameter.builtIns.nullableAnyType) Variance.OUT_VARIANCE -> TypeArgument(typeParameter, typeParameter.builtIns.nothingType, type) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/findUsages/UsageTypeUtils.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/findUsages/UsageTypeUtils.kt index 1c9a7ca31f0..b462e7c2f1b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/findUsages/UsageTypeUtils.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/findUsages/UsageTypeUtils.kt @@ -99,7 +99,7 @@ public object UsageTypeUtils { with(refExpr.getParentOfTypeAndBranch(){ getRight() }) { val opType = this?.getOperationReference()?.getReferencedNameElementType() - opType == JetTokens.AS_KEYWORD || opType == JetTokens.AS_SAFE || opType == JetTokens.COLON + opType == JetTokens.AS_KEYWORD || opType == JetTokens.AS_SAFE } -> CLASS_CAST_TO diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionContributor.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionContributor.kt index 3e2ffdc278f..46cde7c6182 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionContributor.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionContributor.kt @@ -167,7 +167,6 @@ public class KotlinCompletionContributor : CompletionContributor() { val inIncompleteSignature = blockChild.siblings(forward = false, withItself = false).all { when (it) { is PsiWhiteSpace, is PsiComment -> true - is JetBinaryExpressionWithTypeRHS -> it.getOperationReference().getReferencedNameElementType() == JetTokens.COLON else -> false } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 4be6ac73751..c2d54edf35a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -95,7 +95,6 @@ public class QuickFixRegistrar : QuickFixContributor { VIRTUAL_MEMBER_HIDDEN.registerFactory(AddModifierFix.createFactory(OVERRIDE_KEYWORD)) USELESS_CAST.registerFactory(RemoveRightPartOfBinaryExpressionFix.createRemoveTypeFromBinaryExpressionFactory("Remove cast")) - DEPRECATED_STATIC_ASSERT.registerFactory(RemoveRightPartOfBinaryExpressionFix.createRemoveTypeFromBinaryExpressionFactory("Remove static type assertion")) val changeAccessorTypeFactory = ChangeAccessorTypeFix.createFactory() WRONG_SETTER_PARAMETER_TYPE.registerFactory(changeAccessorTypeFactory) diff --git a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.inv.kt b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.inv.kt index 8e1d3a5398c..7a9dc9ae519 100644 --- a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.inv.kt +++ b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.inv.kt @@ -28,9 +28,6 @@ fun test() { a as? String - a : - String - a in 1..2 diff --git a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.kt b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.kt index 8e1d3a5398c..7a9dc9ae519 100644 --- a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.kt +++ b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.after.kt @@ -28,9 +28,6 @@ fun test() { a as? String - a : - String - a in 1..2 diff --git a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.kt b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.kt index ddd894bdafc..78c9a949725 100644 --- a/idea/testData/formatter/BinaryExpressionsWithoutAlignment.kt +++ b/idea/testData/formatter/BinaryExpressionsWithoutAlignment.kt @@ -28,9 +28,6 @@ fun test() { a as? String - a : - String - a in 1..2 diff --git a/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt b/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt index 1fd4864f1a1..88fbd9192ac 100644 --- a/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt +++ b/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt @@ -1,5 +1,5 @@ fun main(args: Array) { - assert(false, "mess": kotlin.String) + assert(false, "mess" as kotlin.String) } // WITH_RUNTIME \ No newline at end of file diff --git a/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt.after b/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt.after index f0d2599f5fe..3fec6346b14 100644 --- a/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt.after +++ b/idea/testData/intentions/convertAssertToIf/doNotShortenReferenceInsideMessage.kt.after @@ -1,6 +1,6 @@ fun main(args: Array) { if (!false) { - throw AssertionError("mess": kotlin.String) + throw AssertionError("mess" as kotlin.String) } } diff --git a/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt b/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt index 17fb24be071..89978a01fe6 100644 --- a/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt +++ b/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: true fun foo() { - bar({ 2 * it }: (Int) -> Int) + bar({ 2 * it } as (Int) -> Int) } fun bar(t: T): Int = 1 \ No newline at end of file diff --git a/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt.after b/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt.after index 3fb1f459be2..acc5a410e9d 100644 --- a/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt.after +++ b/idea/testData/intentions/insertExplicitTypeArguments/insertTypeThatIsAFunction.kt.after @@ -1,6 +1,6 @@ // IS_APPLICABLE: true fun foo() { - bar<(Int) -> Int>({ 2 * it }: (Int) -> Int) + bar<(Int) -> Int>({ 2 * it } as (Int) -> Int) } fun bar(t: T): Int = 1 \ No newline at end of file diff --git a/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt b/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt deleted file mode 100644 index a729da97899..00000000000 --- a/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt +++ /dev/null @@ -1,4 +0,0 @@ -// "Remove static type assertion" "true" -fun foo(a: String) { - val b = a : Any -} diff --git a/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt.after b/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt.after deleted file mode 100644 index cc1ec84fe9f..00000000000 --- a/idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// "Remove static type assertion" "true" -fun foo(a: String) { - val b = a -} diff --git a/idea/testData/quickfix/suppress/forStatement/call.kt b/idea/testData/quickfix/suppress/forStatement/call.kt index aedc3b6276c..f7174cd7725 100644 --- a/idea/testData/quickfix/suppress/forStatement/call.kt +++ b/idea/testData/quickfix/suppress/forStatement/call.kt @@ -1,7 +1,7 @@ // "Suppress 'REDUNDANT_NULLABLE' for statement " "true" fun foo() { - call("": String??) + call("" as String??) } fun call(s: String?) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/colon.kt b/idea/testData/quickfix/suppress/forStatement/colon.kt deleted file mode 100644 index 576dbc900f3..00000000000 --- a/idea/testData/quickfix/suppress/forStatement/colon.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" - -fun foo() { - ""!! : String -} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/colon.kt.after b/idea/testData/quickfix/suppress/forStatement/colon.kt.after deleted file mode 100644 index 032f244bdf7..00000000000 --- a/idea/testData/quickfix/suppress/forStatement/colon.kt.after +++ /dev/null @@ -1,6 +0,0 @@ -// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" - -fun foo() { - @Suppress("UNNECESSARY_NOT_NULL_ASSERTION") - (""!! : String) -} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/postfixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/postfixPlusPlus.kt index fbf5734f311..53f11843c16 100644 --- a/idea/testData/quickfix/suppress/forStatement/postfixPlusPlus.kt +++ b/idea/testData/quickfix/suppress/forStatement/postfixPlusPlus.kt @@ -2,7 +2,7 @@ fun foo() { var v = Box() - (v: Box?>)++ + (v as Box?>)++ } class Box { diff --git a/idea/testData/quickfix/suppress/forStatement/prefixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/prefixPlusPlus.kt index dbae6d379cb..20ea913a9c7 100644 --- a/idea/testData/quickfix/suppress/forStatement/prefixPlusPlus.kt +++ b/idea/testData/quickfix/suppress/forStatement/prefixPlusPlus.kt @@ -2,7 +2,7 @@ fun foo() { var v = Box() - ++(v: Box?>) + ++(v as Box?>) } class Box { diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 59c6e48e0cf..de4a97bcee4 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -3941,12 +3941,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/expressions"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); } - @TestMetadata("removeStaticTypeAssertion.kt") - public void testRemoveStaticTypeAssertion() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/expressions/removeStaticTypeAssertion.kt"); - doTest(fileName); - } - @TestMetadata("removeUselessCast.kt") public void testRemoveUselessCast() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/expressions/removeUselessCast.kt"); @@ -5687,12 +5681,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } - @TestMetadata("colon.kt") - public void testColon() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/suppress/forStatement/colon.kt"); - doTest(fileName); - } - @TestMetadata("doWhile.kt") public void testDoWhile() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/suppress/forStatement/doWhile.kt"); diff --git a/js/js.libraries/src/core/dynamic.kt b/js/js.libraries/src/core/dynamic.kt index 691b0a82f3b..ae7f207baff 100644 --- a/js/js.libraries/src/core/dynamic.kt +++ b/js/js.libraries/src/core/dynamic.kt @@ -16,6 +16,8 @@ package kotlin.js +inline fun Any?.asDynamic(): dynamic = this + // TODO add the support ES6 iterators public fun dynamic.iterator(): Iterator { val r = this @@ -24,9 +26,9 @@ public fun dynamic.iterator(): Iterator { this["iterator"] != null -> this["iterator"]() js("Array.isArray(r)") -> - (this: Array<*>).iterator() + (this as Array<*>).iterator() else -> - (r: Iterable<*>).iterator() + (r as Iterable<*>).iterator() } } diff --git a/js/js.libraries/src/core/kotlin_special.kt b/js/js.libraries/src/core/kotlin_special.kt index a52306b337d..5594d29d13b 100644 --- a/js/js.libraries/src/core/kotlin_special.kt +++ b/js/js.libraries/src/core/kotlin_special.kt @@ -15,7 +15,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col */ public fun Array.asList(): List { val al = ArrayList() - (al: dynamic).array = this // black dynamic magic + al.asDynamic().array = this // black dynamic magic return al } @@ -80,7 +80,7 @@ public inline fun ShortArray.asList(): List { */ @Suppress("NOTHING_TO_INLINE") public inline fun Array.copyOf(): Array { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -88,7 +88,7 @@ public inline fun Array.copyOf(): Array { */ @Suppress("NOTHING_TO_INLINE") public inline fun BooleanArray.copyOf(): BooleanArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -96,7 +96,7 @@ public inline fun BooleanArray.copyOf(): BooleanArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ByteArray.copyOf(): ByteArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -104,7 +104,7 @@ public inline fun ByteArray.copyOf(): ByteArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun CharArray.copyOf(): CharArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -112,7 +112,7 @@ public inline fun CharArray.copyOf(): CharArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun DoubleArray.copyOf(): DoubleArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -120,7 +120,7 @@ public inline fun DoubleArray.copyOf(): DoubleArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun FloatArray.copyOf(): FloatArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -128,7 +128,7 @@ public inline fun FloatArray.copyOf(): FloatArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun IntArray.copyOf(): IntArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -136,7 +136,7 @@ public inline fun IntArray.copyOf(): IntArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun LongArray.copyOf(): LongArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -144,7 +144,7 @@ public inline fun LongArray.copyOf(): LongArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ShortArray.copyOf(): ShortArray { - return (this: dynamic).slice(0) + return this.asDynamic().slice(0) } /** @@ -215,7 +215,7 @@ public fun Array.copyOf(newSize: Int): Array { */ @Suppress("NOTHING_TO_INLINE") public inline fun Array.copyOfRange(fromIndex: Int, toIndex: Int): Array { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -223,7 +223,7 @@ public inline fun Array.copyOfRange(fromIndex: Int, toIndex: Int): Ar */ @Suppress("NOTHING_TO_INLINE") public inline fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -231,7 +231,7 @@ public inline fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): Boolea */ @Suppress("NOTHING_TO_INLINE") public inline fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -239,7 +239,7 @@ public inline fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray */ @Suppress("NOTHING_TO_INLINE") public inline fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -247,7 +247,7 @@ public inline fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray */ @Suppress("NOTHING_TO_INLINE") public inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -255,7 +255,7 @@ public inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleA */ @Suppress("NOTHING_TO_INLINE") public inline fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -263,7 +263,7 @@ public inline fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArr */ @Suppress("NOTHING_TO_INLINE") public inline fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -271,7 +271,7 @@ public inline fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -279,7 +279,7 @@ public inline fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray */ @Suppress("NOTHING_TO_INLINE") public inline fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray { - return (this: dynamic).slice(fromIndex, toIndex) + return this.asDynamic().slice(fromIndex, toIndex) } /** @@ -287,7 +287,7 @@ public inline fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArr */ @Suppress("NOTHING_TO_INLINE") public inline fun Array.plus(array: Array): Array { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -295,7 +295,7 @@ public inline fun Array.plus(array: Array): Array { */ @Suppress("NOTHING_TO_INLINE") public inline fun BooleanArray.plus(array: BooleanArray): BooleanArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -303,7 +303,7 @@ public inline fun BooleanArray.plus(array: BooleanArray): BooleanArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ByteArray.plus(array: ByteArray): ByteArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -311,7 +311,7 @@ public inline fun ByteArray.plus(array: ByteArray): ByteArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun CharArray.plus(array: CharArray): CharArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -319,7 +319,7 @@ public inline fun CharArray.plus(array: CharArray): CharArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun DoubleArray.plus(array: DoubleArray): DoubleArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -327,7 +327,7 @@ public inline fun DoubleArray.plus(array: DoubleArray): DoubleArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun FloatArray.plus(array: FloatArray): FloatArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -335,7 +335,7 @@ public inline fun FloatArray.plus(array: FloatArray): FloatArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun IntArray.plus(array: IntArray): IntArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -343,7 +343,7 @@ public inline fun IntArray.plus(array: IntArray): IntArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun LongArray.plus(array: LongArray): LongArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -351,7 +351,7 @@ public inline fun LongArray.plus(array: LongArray): LongArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ShortArray.plus(array: ShortArray): ShortArray { - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) } /** @@ -422,7 +422,7 @@ public fun ShortArray.plus(collection: Collection): ShortArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun Array.plus(element: T): Array { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -430,7 +430,7 @@ public inline fun Array.plus(element: T): Array { */ @Suppress("NOTHING_TO_INLINE") public inline fun BooleanArray.plus(element: Boolean): BooleanArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -438,7 +438,7 @@ public inline fun BooleanArray.plus(element: Boolean): BooleanArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ByteArray.plus(element: Byte): ByteArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -446,7 +446,7 @@ public inline fun ByteArray.plus(element: Byte): ByteArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun CharArray.plus(element: Char): CharArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -454,7 +454,7 @@ public inline fun CharArray.plus(element: Char): CharArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun DoubleArray.plus(element: Double): DoubleArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -462,7 +462,7 @@ public inline fun DoubleArray.plus(element: Double): DoubleArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun FloatArray.plus(element: Float): FloatArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -470,7 +470,7 @@ public inline fun FloatArray.plus(element: Float): FloatArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun IntArray.plus(element: Int): IntArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -478,7 +478,7 @@ public inline fun IntArray.plus(element: Int): IntArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun LongArray.plus(element: Long): LongArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** @@ -486,7 +486,7 @@ public inline fun LongArray.plus(element: Long): LongArray { */ @Suppress("NOTHING_TO_INLINE") public inline fun ShortArray.plus(element: Short): ShortArray { - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) } /** diff --git a/js/js.translator/testData/char/cases/charConversions.kt b/js/js.translator/testData/char/cases/charConversions.kt index f65aa00b460..e4289440742 100644 --- a/js/js.translator/testData/char/cases/charConversions.kt +++ b/js/js.translator/testData/char/cases/charConversions.kt @@ -4,8 +4,8 @@ fun box(): String { assertEquals('A', 'A'.toChar(), "toChar") assertEquals(65, 'A'.toInt(), "toInt") - assertEquals(65: Short, 'A'.toShort(), "toShort") - assertEquals(65: Byte, 'A'.toByte(), "toByte") + assertEquals(65.toShort(), 'A'.toShort(), "toShort") + assertEquals(65.toByte(), 'A'.toByte(), "toByte") assertEquals(65.0, 'A'.toDouble(), "toDouble") assertEquals(65.0f, 'A'.toFloat(), "toFloat") assertEquals(65L, 'A'.toLong(), "toLong") diff --git a/js/js.translator/testData/char/cases/charEquals.kt b/js/js.translator/testData/char/cases/charEquals.kt index c62da6b6b3f..0aaf799ebe0 100644 --- a/js/js.translator/testData/char/cases/charEquals.kt +++ b/js/js.translator/testData/char/cases/charEquals.kt @@ -6,7 +6,7 @@ fun box(): String { assertEquals(true, 'A' == 'A') assertEquals(false, 'A'== 'B') - assertEquals(false, ('A': Any) == (65: Any)) + assertEquals(false, ('A' as Any) == (65 as Any)) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/char/cases/charIsCheck.kt b/js/js.translator/testData/char/cases/charIsCheck.kt index 7b2a2b13fc1..c0939615b34 100644 --- a/js/js.translator/testData/char/cases/charIsCheck.kt +++ b/js/js.translator/testData/char/cases/charIsCheck.kt @@ -4,15 +4,15 @@ class A fun box(): String { - assertEquals(false, ('A': Any) is Int) - assertEquals(false, ('A': Any) is Short) - assertEquals(false, ('A': Any) is Byte) - assertEquals(false, ('A': Any) is Float) - assertEquals(false, ('A': Any) is Double) - assertEquals(false, ('A': Any) is Number) + assertEquals(false, ('A' as Any) is Int) + assertEquals(false, ('A' as Any) is Short) + assertEquals(false, ('A' as Any) is Byte) + assertEquals(false, ('A' as Any) is Float) + assertEquals(false, ('A' as Any) is Double) + assertEquals(false, ('A' as Any) is Number) assertEquals(true, 'A' is Char) - assertEquals(true, ('A': Any) is Char) + assertEquals(true, ('A' as Any) is Char) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/dataClass/cases/equals.kt b/js/js.translator/testData/dataClass/cases/equals.kt index 8baf4efbdf7..1b731155e25 100644 --- a/js/js.translator/testData/dataClass/cases/equals.kt +++ b/js/js.translator/testData/dataClass/cases/equals.kt @@ -37,7 +37,8 @@ fun box(): String { assertNotEquals(ho1, ho2) assertNotEquals(ho1, ho3) - assertTrue((d1 : Any) != "") + val d1any: Any = d1 + assertTrue(d1any != "") return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/dynamic/cases/iterator.kt b/js/js.translator/testData/dynamic/cases/iterator.kt index 15857b24922..577c279a960 100644 --- a/js/js.translator/testData/dynamic/cases/iterator.kt +++ b/js/js.translator/testData/dynamic/cases/iterator.kt @@ -3,7 +3,7 @@ package foo fun testFor(expected: Int, d: dynamic, case: String) { var actual = 0 for (v in d) { - actual += v: Int + actual += v as Int } assertEquals(expected, actual, "testFor on $case") } @@ -12,7 +12,7 @@ fun testIterator(expected: Int, d: dynamic, case: String) { var actual = 0 val it = d.iterator() while (it.hasNext()) { - actual += it.next(): Int + actual += it.next() as Int } assertEquals(expected, actual, "testIterator on $case") } diff --git a/js/js.translator/testData/enum/cases/nativeEnum.kt b/js/js.translator/testData/enum/cases/nativeEnum.kt index 46bcc2f06b5..f0bf0408bab 100644 --- a/js/js.translator/testData/enum/cases/nativeEnum.kt +++ b/js/js.translator/testData/enum/cases/nativeEnum.kt @@ -13,7 +13,7 @@ enum class JsEnum { fun box(): String { assertEquals(1, JsEnum.Foo) assertEquals("BAR", JsEnum.Bar) - assertEquals("OK", (JsEnum.Baz: dynamic).ok) + assertEquals("OK", JsEnum.Baz.asDynamic().ok) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt b/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt index d5cf02c093d..dd9dbade87d 100644 --- a/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt +++ b/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt @@ -25,9 +25,10 @@ fun testMethodAsCompareTo() { assertEquals(true, x > y, "meth: x > y") assertEquals(1, x compareTo y, "meth: x compareTo y") - assertEquals(false, (x: Comparable) < y, "meth: (x: Comparable) < y") - assertEquals(true, (x: Comparable) > y, "meth: (x: Comparable) > y") - assertEquals(1, (x: Comparable) compareTo y, "meth: (x: Comparable) compareTo y") + val comparable: Comparable = x + assertEquals(false, comparable < y, "meth: (x: Comparable) < y") + assertEquals(true, comparable > y, "meth: (x: Comparable) > y") + assertEquals(1, comparable compareTo y, "meth: (x: Comparable) compareTo y") } fun box(): String { diff --git a/js/js.translator/testData/expression/equals/cases/explicitEqualsMethodForPrimitives.kt b/js/js.translator/testData/expression/equals/cases/explicitEqualsMethodForPrimitives.kt index cfd966333ac..8a38f166c6f 100644 --- a/js/js.translator/testData/expression/equals/cases/explicitEqualsMethodForPrimitives.kt +++ b/js/js.translator/testData/expression/equals/cases/explicitEqualsMethodForPrimitives.kt @@ -7,7 +7,7 @@ fun box(): Boolean { if (!(a equals 2.0)) return false val c = "a" if (!("a" equals c)) return false - if (!((null : Any?)?.equals(null) ?: true)) return false + if (!((null as Any?)?.equals(null) ?: true)) return false val d = 5.6 if (!(d.toShort() equals 5.toShort())) return false if (!(d.toByte() equals 5.toByte())) return false diff --git a/js/js.translator/testData/expression/function/cases/manglingAnyMethods.kt b/js/js.translator/testData/expression/function/cases/manglingAnyMethods.kt index 3ce1ce0e17a..e2354f9fe06 100644 --- a/js/js.translator/testData/expression/function/cases/manglingAnyMethods.kt +++ b/js/js.translator/testData/expression/function/cases/manglingAnyMethods.kt @@ -37,7 +37,7 @@ private class PrivateClass { val CALEE_NAME = RegExp("""((?:equals|hashCode|toString)[^(]*)""") fun Function0.extractNames(): Array { - val names = CALEE_NAME.exec(this.toString(): String) + val names = CALEE_NAME.exec(this.toString()) if (names == null || names.size() != 2) { throw Exception("Cannot extract function name, $names for actual = \"$this\"") diff --git a/js/js.translator/testData/expression/string/cases/subSequence.kt b/js/js.translator/testData/expression/string/cases/subSequence.kt index c1496ae14f3..2e4d03987f5 100644 --- a/js/js.translator/testData/expression/string/cases/subSequence.kt +++ b/js/js.translator/testData/expression/string/cases/subSequence.kt @@ -8,7 +8,7 @@ fun box(): String { val kot: CharSequence = kotlin.subSequence(0, 3) if (kot.toString() != "kot") return "Fail 1: $kot" - val tlin = (kotlin : CharSequence).subSequence(2, 6) + val tlin = (kotlin as CharSequence).subSequence(2, 6) if (tlin.toString() != "tlin") return "Fail 2: $tlin" return "OK" diff --git a/js/js.translator/testData/expression/when/cases/matchNullableType.kt b/js/js.translator/testData/expression/when/cases/matchNullableType.kt index e4680f48ca8..c4af8be3948 100644 --- a/js/js.translator/testData/expression/when/cases/matchNullableType.kt +++ b/js/js.translator/testData/expression/when/cases/matchNullableType.kt @@ -5,7 +5,7 @@ class A() { } fun box(): Boolean { - var a = null : A? + var a: A? = null when(a) { is A? -> return true else -> return false diff --git a/js/js.translator/testData/expression/when/cases/whenValueOrType.kt b/js/js.translator/testData/expression/when/cases/whenValueOrType.kt index 773acdc7076..b2d1bb8dfb1 100644 --- a/js/js.translator/testData/expression/when/cases/whenValueOrType.kt +++ b/js/js.translator/testData/expression/when/cases/whenValueOrType.kt @@ -10,8 +10,8 @@ class B() { fun box(): Boolean { var c: Int = 0 - var a = A() : Any? - var b = null : Any? + var a: Any? = A() + var b: Any? = null when(a) { null -> c = 10; is B -> c = 10000 diff --git a/js/js.translator/testData/nameClashes/cases/methodOverloadInClassWithTwoUpperBounds.kt b/js/js.translator/testData/nameClashes/cases/methodOverloadInClassWithTwoUpperBounds.kt index 259dced97e7..02acda60977 100644 --- a/js/js.translator/testData/nameClashes/cases/methodOverloadInClassWithTwoUpperBounds.kt +++ b/js/js.translator/testData/nameClashes/cases/methodOverloadInClassWithTwoUpperBounds.kt @@ -21,9 +21,11 @@ public class MyNode : Node() { fun box(): String { var node = MyNode() + val traitA: TraitA = ClassAB() + val traitB: TraitB = ClassAB() assertEquals("MyNode.bar(ClassAB)", node.bar(ClassAB())) - assertEquals("MyNode.bar(TraitA)", node.bar(ClassAB(): TraitA)) - assertEquals("MyNode.bar(TraitB)", node.bar(ClassAB(): TraitB)) + assertEquals("MyNode.bar(TraitA)", node.bar(traitA)) + assertEquals("MyNode.bar(TraitB)", node.bar(traitB)) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/number/cases/conversionsWithTruncation.kt b/js/js.translator/testData/number/cases/conversionsWithTruncation.kt index 65be00f664c..9291bf09d25 100644 --- a/js/js.translator/testData/number/cases/conversionsWithTruncation.kt +++ b/js/js.translator/testData/number/cases/conversionsWithTruncation.kt @@ -14,8 +14,8 @@ fun box(): String { assertEquals(65, 321.toByte()) assertEquals(-56, 200.toByte()) - assertEquals(65, (321: Short).toByte()) - assertEquals(-56, (200: Short).toByte()) + assertEquals(65, (321.toShort()).toByte()) + assertEquals(-56, (200.toShort()).toByte()) assertEquals(-1, 65535.0.toShort()) assertEquals(-1, 65535.0f.toShort()) diff --git a/js/js.translator/testData/number/cases/conversionsWithoutTruncation.kt b/js/js.translator/testData/number/cases/conversionsWithoutTruncation.kt index 09179473dc9..d9e98e6fc72 100644 --- a/js/js.translator/testData/number/cases/conversionsWithoutTruncation.kt +++ b/js/js.translator/testData/number/cases/conversionsWithoutTruncation.kt @@ -5,8 +5,8 @@ fun testForNumber(numberX: Number) { assertEquals(true, 65.0f == numberX.toFloat()) assertEquals(true, 65L == numberX.toLong()) assertEquals(true, 65 == numberX.toInt()) - assertEquals(true, (65: Short) == numberX.toShort()) - assertEquals(true, (65: Byte) == numberX.toByte()) + assertEquals(true, 65.toShort() == numberX.toShort()) + assertEquals(true, 65.toByte() == numberX.toByte()) assertEquals(true, 'A' == numberX.toChar()) } @@ -16,16 +16,16 @@ fun box(): String { testForNumber(65.0f) testForNumber(65L) testForNumber(65) - testForNumber(65: Short) - testForNumber(65: Byte) + testForNumber(65.toShort()) + testForNumber(65.toByte()) var doubleX: Double = 65.0 assertEquals(true, 65.0 == doubleX.toDouble()) assertEquals(true, 65.0f == doubleX.toFloat()) assertEquals(true, 65L == doubleX.toLong()) assertEquals(true, 65 == doubleX.toInt()) - assertEquals(true, (65: Short) == doubleX.toShort()) - assertEquals(true, (65: Byte) == doubleX.toByte()) + assertEquals(true, 65.toShort() == doubleX.toShort()) + assertEquals(true, 65.toByte() == doubleX.toByte()) assertEquals(true, 'A' == doubleX.toChar()) var floatX: Float = 65.0f @@ -33,8 +33,8 @@ fun box(): String { assertEquals(true, 65.0f == floatX.toFloat()) assertEquals(true, 65L == floatX.toLong()) assertEquals(true, 65 == floatX.toInt()) - assertEquals(true, (65: Short) == floatX.toShort()) - assertEquals(true, (65: Byte) == floatX.toByte()) + assertEquals(true, 65.toShort() == floatX.toShort()) + assertEquals(true, 65.toByte() == floatX.toByte()) assertEquals(true, 'A' == floatX.toChar()) val longX: Long = 65L @@ -42,8 +42,8 @@ fun box(): String { assertEquals(true, 65.0f == longX.toFloat()) assertEquals(true, 65L == longX.toLong()) assertEquals(true, 65 == longX.toInt()) - assertEquals(true, (65: Short) == longX.toShort()) - assertEquals(true, (65: Byte) == longX.toByte()) + assertEquals(true, 65.toShort() == longX.toShort()) + assertEquals(true, 65.toByte() == longX.toByte()) assertEquals(true, 'A' == longX.toChar()) val intX: Int = 65 @@ -51,26 +51,26 @@ fun box(): String { assertEquals(true, 65.0f == intX.toFloat()) assertEquals(true, 65L == intX.toLong()) assertEquals(true, 65 == intX.toInt()) - assertEquals(true, (65: Short) == intX.toShort()) - assertEquals(true, (65: Byte) == intX.toByte()) + assertEquals(true, 65.toShort() == intX.toShort()) + assertEquals(true, 65.toByte() == intX.toByte()) assertEquals(true, 'A' == intX.toChar()) - val shortX: Short = 65: Short + val shortX: Short = 65.toShort() assertEquals(true, 65.0 == shortX.toDouble()) assertEquals(true, 65.0f == shortX.toFloat()) assertEquals(true, 65L == shortX.toLong()) assertEquals(true, 65 == shortX.toInt()) - assertEquals(true, (65: Short) == shortX.toShort()) - assertEquals(true, (65: Byte) == shortX.toByte()) + assertEquals(true, 65.toShort() == shortX.toShort()) + assertEquals(true, 65.toByte() == shortX.toByte()) assertEquals(true, 'A' == shortX.toChar()) - val byteX: Byte = 65: Byte + val byteX: Byte = 65.toByte() assertEquals(true, 65.0 == byteX.toDouble()) assertEquals(true, 65.0f == byteX.toFloat()) assertEquals(true, 65L == byteX.toLong()) assertEquals(true, 65 == byteX.toInt()) - assertEquals(true, (65: Short) == byteX.toShort()) - assertEquals(true, (65: Byte) == byteX.toByte()) + assertEquals(true, 65.toShort() == byteX.toShort()) + assertEquals(true, 65.toByte() == byteX.toByte()) assertEquals(true, 'A' == byteX.toChar()) return "OK" diff --git a/js/js.translator/testData/number/cases/intDivFloat.kt b/js/js.translator/testData/number/cases/intDivFloat.kt index de57a180b30..171e65edc4c 100644 --- a/js/js.translator/testData/number/cases/intDivFloat.kt +++ b/js/js.translator/testData/number/cases/intDivFloat.kt @@ -8,11 +8,11 @@ fun box(): String { assertEquals(0.5f, 1 / 2.0f, "Int / Float") assertEquals(0.5, 1 / 2.0, "Int / Double") - assertEquals(0.5f, (1: Short) / 2.0f, "Short / Float") - assertEquals(0.5, (1: Short) / 2.0, "Short / Double") + assertEquals(0.5f, 1.toShort() / 2.0f, "Short / Float") + assertEquals(0.5, 1.toShort() / 2.0, "Short / Double") - assertEquals(0.5f, (1: Byte) / 2.0f, "Byte / Float") - assertEquals(0.5, (1: Byte) / 2.0, "Byte / Double") + assertEquals(0.5f, 1.toByte() / 2.0f, "Byte / Float") + assertEquals(0.5, 1.toByte() / 2.0, "Byte / Double") return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/number/cases/longBinaryOperations.kt b/js/js.translator/testData/number/cases/longBinaryOperations.kt index bdea46b14cc..8e39889294c 100644 --- a/js/js.translator/testData/number/cases/longBinaryOperations.kt +++ b/js/js.translator/testData/number/cases/longBinaryOperations.kt @@ -19,14 +19,14 @@ fun box(): String { assertEquals(30.0f, 10L + 20.0f) assertEquals(30L, 10L + 20L) assertEquals(30L, 10L + 20) - assertEquals(30L, 10L + (20: Short)) - assertEquals(30L, 10L + (20: Byte)) + assertEquals(30L, 10L + 20.toShort()) + assertEquals(30L, 10L + 20.toByte()) assertEquals(30.0, 20.0 + 10L) assertEquals(30.0f, 20.0f + 10L) assertEquals(20L, 10 + 10L) - assertEquals(20L, (10: Short) + 10L) - assertEquals(20L, (10: Byte) + 10L) + assertEquals(20L, 10.toShort() + 10L) + assertEquals(20L, 10.toByte() + 10L) assertEquals(20L, 30 - 10L) diff --git a/js/js.translator/testData/number/cases/longCompareToIntrinsic.kt b/js/js.translator/testData/number/cases/longCompareToIntrinsic.kt index 779d28def12..3e8cd0a3a84 100644 --- a/js/js.translator/testData/number/cases/longCompareToIntrinsic.kt +++ b/js/js.translator/testData/number/cases/longCompareToIntrinsic.kt @@ -12,10 +12,10 @@ fun box(): String { assertEquals(true, 10 < 20L, "Int.compareTo(Long)") assertEquals(true, 10 < 7540113804746346429L, "Int.compareTo(Long)") - assertEquals(true, (10: Short) < 20L, "Short.compareTo(Long)") - assertEquals(true, (10: Short) < 7540113804746346429L, "Short.compareTo(Long)") - assertEquals(true, (10: Byte) < 20L, "Byte.compareTo(Long)") - assertEquals(true, (10: Byte) < 7540113804746346429L, "Byte.compareTo(Long)") + assertEquals(true, 10.toShort() < 20L, "Short.compareTo(Long)") + assertEquals(true, 10.toShort() < 7540113804746346429L, "Short.compareTo(Long)") + assertEquals(true, 10.toByte() < 20L, "Byte.compareTo(Long)") + assertEquals(true, 10.toByte() < 7540113804746346429L, "Byte.compareTo(Long)") assertEquals(true, 10L < 20.0, "Long.compareTo(Double)") assertEquals(false, 7540113804746346429L < 20.0, "Long.compareTo(Double)") @@ -28,13 +28,13 @@ fun box(): String { assertEquals(true, 7540113804746346429L > 20, "Long.compareTo(Int)") assertEquals(false, 7540113804746346429L < 20, "Long.compareTo(Int)") - assertEquals(true, 10L < (20: Short), "Long.compareTo(Short)") - assertEquals(true, 7540113804746346429L > (20: Short), "Long.compareTo(Short)") - assertEquals(false, 7540113804746346429L < (20: Short), "Long.compareTo(Short)") + assertEquals(true, 10L < 20.toShort(), "Long.compareTo(Short)") + assertEquals(true, 7540113804746346429L > 20.toShort(), "Long.compareTo(Short)") + assertEquals(false, 7540113804746346429L < 20.toShort(), "Long.compareTo(Short)") - assertEquals(true, 10L < (20: Byte), "Long.compareTo(Byte)") - assertEquals(true, 7540113804746346429L > (20: Byte), "Long.compareTo(Byte)") - assertEquals(false, 7540113804746346429L < (20: Byte), "Long.compareTo(Byte)") + assertEquals(true, 10L < 20.toByte(), "Long.compareTo(Byte)") + assertEquals(true, 7540113804746346429L > 20.toByte(), "Long.compareTo(Byte)") + assertEquals(false, 7540113804746346429L < 20.toByte(), "Long.compareTo(Byte)") return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/number/cases/numberCompareTo.kt b/js/js.translator/testData/number/cases/numberCompareTo.kt index 9507a39d539..90110777da7 100644 --- a/js/js.translator/testData/number/cases/numberCompareTo.kt +++ b/js/js.translator/testData/number/cases/numberCompareTo.kt @@ -10,72 +10,72 @@ fun id(s: String, value: Int): Int { fun box(): String { assertEquals(-1, 1.compareTo(2)) - assertEquals(-1, (1: Comparable).compareTo(2)) + assertEquals(-1, (1 as Comparable).compareTo(2)) assertEquals(-1, 1 compareTo 2L) assertEquals(-1, 1 compareTo 2L) assertEquals(-1, 1 compareTo 7540113804746346429L) - assertEquals(-1, 1 compareTo (2:Short)) - assertEquals(-1, 1 compareTo (2:Byte)) + assertEquals(-1, 1 compareTo 2.toShort()) + assertEquals(-1, 1 compareTo 2.toByte()) assertEquals(-1, 1 compareTo 2.0) assertEquals(-1, 1 compareTo 2.0f) assertEquals(1, 10 compareTo 2L) assertEquals(1, 10 compareTo 2) - assertEquals(1, 10 compareTo (2:Short)) - assertEquals(1, 10 compareTo (2:Byte)) + assertEquals(1, 10 compareTo 2.toShort()) + assertEquals(1, 10 compareTo 2.toByte()) assertEquals(1, 10 compareTo 2.0) assertEquals(1, 10 compareTo 2.0f) assertEquals(0, 2 compareTo 2L) assertEquals(0, 2 compareTo 2) - assertEquals(0, 2 compareTo (2:Short)) - assertEquals(0, 2 compareTo (2:Byte)) + assertEquals(0, 2 compareTo 2.toShort()) + assertEquals(0, 2 compareTo 2.toByte()) assertEquals(0, 2 compareTo 2.0) assertEquals(0, 2 compareTo 2.0f) - assertEquals(-1, (1: Short) compareTo 2L) - assertEquals(-1, (1: Short) compareTo 7540113804746346429L) - assertEquals(-1, (1: Short) compareTo 2) - assertEquals(-1, (1: Short) compareTo (2:Short)) - assertEquals(-1, ((1: Short): Comparable) compareTo (2:Short)) - assertEquals(-1, (1: Short) compareTo (2:Byte)) - assertEquals(-1, (1: Short) compareTo 2.0) - assertEquals(-1, (1: Short) compareTo 2.0f) + assertEquals(-1, 1.toShort() compareTo 2L) + assertEquals(-1, 1.toShort() compareTo 7540113804746346429L) + assertEquals(-1, 1.toShort() compareTo 2) + assertEquals(-1, 1.toShort() compareTo 2.toShort()) + assertEquals(-1, (1.toShort() as Comparable) compareTo 2.toShort()) + assertEquals(-1, 1.toShort() compareTo 2.toByte()) + assertEquals(-1, 1.toShort() compareTo 2.0) + assertEquals(-1, 1.toShort() compareTo 2.0f) - assertEquals(1, (10: Byte) compareTo 2L) - assertEquals(-1, (10: Byte) compareTo 7540113804746346429L) - assertEquals(1, (10: Byte) compareTo 2) - assertEquals(1, (10: Byte) compareTo (2:Short)) - assertEquals(1, (10: Byte) compareTo (2:Byte)) - assertEquals(1, ((10: Byte): Comparable) compareTo (2:Byte)) - assertEquals(1, (10: Byte) compareTo 2.0) - assertEquals(1, (10: Byte) compareTo 2.0f) + assertEquals(1, 10.toByte() compareTo 2L) + assertEquals(-1, 10.toByte() compareTo 7540113804746346429L) + assertEquals(1, 10.toByte() compareTo 2) + assertEquals(1, 10.toByte() compareTo 2.toShort()) + assertEquals(1, 10.toByte() compareTo 2.toByte()) + assertEquals(1, (10.toByte() as Comparable) compareTo 2.toByte()) + assertEquals(1, 10.toByte() compareTo 2.0) + assertEquals(1, 10.toByte() compareTo 2.0f) assertEquals(0, 2.0 compareTo 2L) assertEquals(-1, 2.0 compareTo 7540113804746346429L) assertEquals(0, 2.0 compareTo 2) - assertEquals(0, 2.0 compareTo (2:Short)) - assertEquals(0, 2.0 compareTo (2:Byte)) + assertEquals(0, 2.0 compareTo 2.toShort()) + assertEquals(0, 2.0 compareTo 2.toByte()) assertEquals(0, 2.0 compareTo 2.0) - assertEquals(0, (2.0: Comparable) compareTo 2.0) + assertEquals(0, (2.0 as Comparable) compareTo 2.0) assertEquals(0, 2.0 compareTo 2.0f) assertEquals(1, 3.0f compareTo 2L) assertEquals(-1, 3.0f compareTo 7540113804746346429L) assertEquals(1, 3.0f compareTo 2) - assertEquals(1, 3.0f compareTo (2:Short)) - assertEquals(1, 3.0f compareTo (2:Byte)) + assertEquals(1, 3.0f compareTo 2.toShort()) + assertEquals(1, 3.0f compareTo 2.toByte()) assertEquals(1, 3.0f compareTo 2.0) assertEquals(1, 3.0f compareTo 2.0f) - assertEquals(1, (3.0f: Comparable) compareTo 2.0f) + assertEquals(1, (3.0f as Comparable) compareTo 2.0f) assertEquals(1, 10L compareTo 2L) assertEquals(-1, 10L compareTo 7540113804746346429L) - assertEquals(1, (10L: Comparable) compareTo 2L) + assertEquals(1, (10L as Comparable) compareTo 2L) assertEquals(1, 10L compareTo 2) - assertEquals(1, 10L compareTo (2:Short)) - assertEquals(1, 10L compareTo (2:Byte)) + assertEquals(1, 10L compareTo 2.toShort()) + assertEquals(1, 10L compareTo 2.toByte()) assertEquals(1, 10L compareTo 2.0) assertEquals(1, 10L compareTo 2.0f) @@ -83,8 +83,8 @@ fun box(): String { assertEquals(-1, 1L compareTo 2L) assertEquals(-1, 1L compareTo 2) - assertEquals(-1, 1L compareTo (2:Short)) - assertEquals(-1, 1L compareTo (2:Byte)) + assertEquals(-1, 1L compareTo 2.toShort()) + assertEquals(-1, 1L compareTo 2.toByte()) assertEquals(-1, 1L compareTo 2.0) assertEquals(-1, 1L compareTo 2.0f) @@ -92,29 +92,29 @@ fun box(): String { assertEquals(1, 7540113804746346429L compareTo 2L) assertEquals(0, 2L compareTo 2L) assertEquals(0, 2L compareTo 2) - assertEquals(0, 2L compareTo (2:Short)) - assertEquals(0, 2L compareTo (2:Byte)) + assertEquals(0, 2L compareTo 2.toShort()) + assertEquals(0, 2L compareTo 2.toByte()) assertEquals(0, 2L compareTo 2.0) assertEquals(0, 2L compareTo 2.0f) assertEquals(1, 10L compareTo 2L) assertEquals(1, 10L compareTo 2) - assertEquals(1, 10L compareTo (2:Short)) - assertEquals(1, 10L compareTo (2:Byte)) + assertEquals(1, 10L compareTo 2.toShort()) + assertEquals(1, 10L compareTo 2.toByte()) assertEquals(1, 10L compareTo 2.0) assertEquals(1, 10L compareTo 2.0f) assertEquals(-1, 1L compareTo 2L) assertEquals(-1, 1L compareTo 2) - assertEquals(-1, 1L compareTo (2:Short)) - assertEquals(-1, 1L compareTo (2:Byte)) + assertEquals(-1, 1L compareTo 2.toShort()) + assertEquals(-1, 1L compareTo 2.toByte()) assertEquals(-1, 1L compareTo 2.0) assertEquals(-1, 1L compareTo 2.0f) assertEquals(0, 2L compareTo 2L) assertEquals(0, 2L compareTo 2) - assertEquals(0, 2L compareTo (2:Short)) - assertEquals(0, 2L compareTo (2:Byte)) + assertEquals(0, 2L compareTo 2.toShort()) + assertEquals(0, 2L compareTo 2.toByte()) assertEquals(0, 2L compareTo 2.0) assertEquals(0, 2L compareTo 2.0f) diff --git a/js/js.translator/testData/number/cases/numberIsCheck.kt b/js/js.translator/testData/number/cases/numberIsCheck.kt index 437287630dd..dd68285d04c 100644 --- a/js/js.translator/testData/number/cases/numberIsCheck.kt +++ b/js/js.translator/testData/number/cases/numberIsCheck.kt @@ -36,8 +36,8 @@ fun box(): String { assertEquals(false, anyX is Number, "anyX is Number") testNum(100) - testNum(100: Short) - testNum(100: Byte) + testNum(100.toShort()) + testNum(100.toByte()) testNum(100.0) testNum(100.0f) diff --git a/js/js.translator/testData/range/cases/rangeEquals.kt b/js/js.translator/testData/range/cases/rangeEquals.kt index 2551510727d..cfad3776dd8 100644 --- a/js/js.translator/testData/range/cases/rangeEquals.kt +++ b/js/js.translator/testData/range/cases/rangeEquals.kt @@ -4,9 +4,9 @@ fun box(): String { assertEquals(true, 2..1 == 4..2, "2..1 == 4..2") assertEquals(true, 2L..1L == 318238945677L..2L, "2L..1L == 318238945677L..2L") - assertEquals(false, (2..1): Any == (4L..2L): Any, "(2..1): Any == (4L..2L): Any") + assertEquals(false, (2..1) as Any == (4L..2L) as Any, "(2..1): Any == (4L..2L): Any") assertEquals(true, 'B'..'A' == 'W'..'B', "'B'..'A' == 'W'..'B'") - assertEquals(false, (2..1): Any == ('B'..'A'): Any, "(2..1): Any == ('B'..'A'): Any") + assertEquals(false, (2..1) as Any == ('B'..'A') as Any, "(2..1): Any == ('B'..'A'): Any") return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/rtti/cases/stdlibEmptyListClass.kt b/js/js.translator/testData/rtti/cases/stdlibEmptyListClass.kt index 8b70de7fb53..2f5c90029c9 100644 --- a/js/js.translator/testData/rtti/cases/stdlibEmptyListClass.kt +++ b/js/js.translator/testData/rtti/cases/stdlibEmptyListClass.kt @@ -8,8 +8,8 @@ class stdlib_emptyListClass : List by ArrayList() {} fun box(): String { assertTrue(stdlib_emptyListClass() is List<*>, "stdlib_emptyListClass() is List<*> #1") - assertTrue((stdlib_emptyListClass(): Any) is List<*>, "stdlib_emptyListClass() is List<*> #2") - assertTrue((stdlib_emptyListClass(): Any) !is ArrayList<*>, "stdlib_emptyListClass() !is ArrayList<*>") + assertTrue((stdlib_emptyListClass() as Any) is List<*>, "stdlib_emptyListClass() is List<*> #2") + assertTrue((stdlib_emptyListClass() as Any) !is ArrayList<*>, "stdlib_emptyListClass() !is ArrayList<*>") assertTrue(stdlib_emptyListClass().isEmpty, "stdlib_emptyListClass().isEmpty") assertTrue(stdlib_emptyListClass().size() == 0, "stdlib_emptyListClass().size() == 0") diff --git a/js/js.translator/testData/standardClasses/cases/hashMapTypeOfElement.kt b/js/js.translator/testData/standardClasses/cases/hashMapTypeOfElement.kt index 070629d3f94..78b367b6aca 100644 --- a/js/js.translator/testData/standardClasses/cases/hashMapTypeOfElement.kt +++ b/js/js.translator/testData/standardClasses/cases/hashMapTypeOfElement.kt @@ -14,11 +14,11 @@ fun box(): String { assertEquals("number", typeof (mapWithIntKeys.keySet().iterator().next()), "mapWithIntKeys") val mapWithShortKeys = HashMap() - mapWithShortKeys[1: Short] = 1 + mapWithShortKeys[1.toShort()] = 1 assertEquals("number", typeof (mapWithShortKeys.keySet().iterator().next()), "mapWithShortKeys") val mapWithByteKeys = HashMap() - mapWithByteKeys[1: Byte] = 1 + mapWithByteKeys[1.toByte()] = 1 assertEquals("number", typeof (mapWithByteKeys.keySet().iterator().next()), "mapWithByteKeys") val mapWithDoubleKeys = HashMap() diff --git a/js/js.translator/testData/standardClasses/cases/hashSetTypeOfElement.kt b/js/js.translator/testData/standardClasses/cases/hashSetTypeOfElement.kt index 8c5f3875a76..90026374e38 100644 --- a/js/js.translator/testData/standardClasses/cases/hashSetTypeOfElement.kt +++ b/js/js.translator/testData/standardClasses/cases/hashSetTypeOfElement.kt @@ -14,11 +14,11 @@ fun box(): String { assertEquals("number", typeof (intSet.iterator().next()), "intSet") val shortSet = HashSet() - shortSet.add(1: Short) + shortSet.add(1.toShort()) assertEquals("number", typeof (shortSet.iterator().next()), "shortSet") val byteSet = HashSet() - byteSet.add(1: Byte) + byteSet.add(1.toByte()) assertEquals("number", typeof (byteSet.iterator().next()), "byteSet") val doubleSet = HashSet() diff --git a/libraries/stdlib/test/TuplesTest.kt b/libraries/stdlib/test/TuplesTest.kt index 8013381aa9f..6c1284505c9 100644 --- a/libraries/stdlib/test/TuplesTest.kt +++ b/libraries/stdlib/test/TuplesTest.kt @@ -28,7 +28,7 @@ class PairTest { assertNotEquals(Pair(2, "a"), p) assertNotEquals(Pair(1, "b"), p) assertTrue(!p.equals(null)) - assertNotEquals("", (p : Any)) + assertNotEquals("", (p as Any)) } @test fun pairHashCode() { @@ -78,7 +78,7 @@ class TripleTest { assertNotEquals(Triple(1, "b", 0.07), t) assertNotEquals(Triple(1, "a", 0.1), t) assertTrue(!t.equals(null)) - assertNotEquals("", (t : Any)) + assertNotEquals("", (t as Any)) } @test fun tripleHashCode() { diff --git a/libraries/stdlib/test/collections/ArraysTest.kt b/libraries/stdlib/test/collections/ArraysTest.kt index 588b6cba3c4..f99906a89b3 100644 --- a/libraries/stdlib/test/collections/ArraysTest.kt +++ b/libraries/stdlib/test/collections/ArraysTest.kt @@ -282,7 +282,7 @@ class ArraysTest { expect(0) { arrayOf("cat", "dog", "bird").indexOf("cat") } expect(1) { arrayOf("cat", "dog", "bird").indexOf("dog") } expect(2) { arrayOf("cat", "dog", "bird").indexOf("bird") } - expect(0) { arrayOf(null, "dog", null).indexOf(null : String?)} + expect(0) { arrayOf(null, "dog", null).indexOf(null as String?)} expect(-1) { arrayOf("cat", "dog", "bird").indexOfFirst { it.contains("p") } } expect(0) { arrayOf("cat", "dog", "bird").indexOfFirst { it.startsWith('c') } } @@ -299,7 +299,7 @@ class ArraysTest { expect(-1) { arrayOf("cat", "dog", "bird").lastIndexOf("mouse") } expect(0) { arrayOf("cat", "dog", "bird").lastIndexOf("cat") } expect(1) { arrayOf("cat", "dog", "bird").lastIndexOf("dog") } - expect(2) { arrayOf(null, "dog", null).lastIndexOf(null : String?)} + expect(2) { arrayOf(null, "dog", null).lastIndexOf(null as String?)} expect(3) { arrayOf("cat", "dog", "bird", "dog").lastIndexOf("dog") } expect(-1) { arrayOf("cat", "dog", "bird").indexOfLast { it.contains("p") } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJS.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJS.kt index 33179fe1257..c63999d74bc 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJS.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJS.kt @@ -12,7 +12,7 @@ fun specialJS(): List { body(ArraysOfObjects) { """ val al = ArrayList() - (al: dynamic).array = this // black dynamic magic + al.asDynamic().array = this // black dynamic magic return al """ } @@ -46,7 +46,7 @@ fun specialJS(): List { returns("SELF") returns(ArraysOfObjects) { "Array" } body { - "return (this: dynamic).slice(fromIndex, toIndex)" + "return this.asDynamic().slice(fromIndex, toIndex)" } } @@ -58,7 +58,7 @@ fun specialJS(): List { returns("SELF") returns(ArraysOfObjects) { "Array" } body { - "return (this: dynamic).slice(0)" + "return this.asDynamic().slice(0)" } } @@ -99,7 +99,7 @@ fun specialJS(): List { doc { "Returns an array containing all elements of the original array and then the given [element]." } body() { """ - return (this: dynamic).concat(arrayOf(element)) + return this.asDynamic().concat(arrayOf(element)) """ } } @@ -126,7 +126,7 @@ fun specialJS(): List { returns(ArraysOfObjects) { "Array" } body { """ - return (this: dynamic).concat(array) + return this.asDynamic().concat(array) """ } }