removing static type assertions work in progress
This commit is contained in:
@@ -1578,7 +1578,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
for (Iterator<JetExpression> iterator = statements.iterator(); iterator.hasNext(); ) {
|
for (Iterator<JetExpression> iterator = statements.iterator(); iterator.hasNext(); ) {
|
||||||
JetExpression possiblyLabeledStatement = iterator.next();
|
JetExpression possiblyLabeledStatement = iterator.next();
|
||||||
|
|
||||||
JetElement statement = JetPsiUtil.safeDeparenthesize(possiblyLabeledStatement, true);
|
JetElement statement = JetPsiUtil.safeDeparenthesize(possiblyLabeledStatement);
|
||||||
|
|
||||||
if (statement instanceof JetNamedDeclaration) {
|
if (statement instanceof JetNamedDeclaration) {
|
||||||
JetNamedDeclaration declaration = (JetNamedDeclaration) statement;
|
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) {
|
public StackValue visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression, StackValue receiver) {
|
||||||
JetExpression left = expression.getLeft();
|
JetExpression left = expression.getLeft();
|
||||||
final IElementType opToken = expression.getOperationReference().getReferencedNameElementType();
|
final IElementType opToken = expression.getOperationReference().getReferencedNameElementType();
|
||||||
if (opToken == JetTokens.COLON) {
|
|
||||||
return gen(left);
|
|
||||||
}
|
|
||||||
|
|
||||||
final JetType rightType = bindingContext.get(TYPE, expression.getRight());
|
final JetType rightType = bindingContext.get(TYPE, expression.getRight());
|
||||||
assert rightType != null;
|
assert rightType != null;
|
||||||
|
|||||||
@@ -1203,7 +1203,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||||
JetExpression left = expression.getLeft();
|
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);
|
generateInstructions(left);
|
||||||
if (getBoundOrUnreachableValue(left) != null) {
|
if (getBoundOrUnreachableValue(left) != null) {
|
||||||
createNonSyntheticValue(expression, MagicKind.CAST, left);
|
createNonSyntheticValue(expression, MagicKind.CAST, left);
|
||||||
|
|||||||
@@ -635,7 +635,6 @@ public interface Errors {
|
|||||||
DiagnosticFactory1<JetElement, JetType> CANNOT_CHECK_FOR_ERASED = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<JetElement, JetType> CANNOT_CHECK_FOR_ERASED = DiagnosticFactory1.create(ERROR);
|
||||||
DiagnosticFactory2<JetBinaryExpressionWithTypeRHS, JetType, JetType> UNCHECKED_CAST = DiagnosticFactory2.create(WARNING);
|
DiagnosticFactory2<JetBinaryExpressionWithTypeRHS, JetType, JetType> UNCHECKED_CAST = DiagnosticFactory2.create(WARNING);
|
||||||
|
|
||||||
DiagnosticFactory0<JetBinaryExpressionWithTypeRHS> DEPRECATED_STATIC_ASSERT = DiagnosticFactory0.create(WARNING, AS_TYPE);
|
|
||||||
DiagnosticFactory0<JetBinaryExpressionWithTypeRHS> USELESS_CAST = DiagnosticFactory0.create(WARNING, AS_TYPE);
|
DiagnosticFactory0<JetBinaryExpressionWithTypeRHS> USELESS_CAST = DiagnosticFactory0.create(WARNING, AS_TYPE);
|
||||||
DiagnosticFactory0<JetSimpleNameExpression> CAST_NEVER_SUCCEEDS = DiagnosticFactory0.create(WARNING);
|
DiagnosticFactory0<JetSimpleNameExpression> CAST_NEVER_SUCCEEDS = DiagnosticFactory0.create(WARNING);
|
||||||
DiagnosticFactory0<JetTypeReference> DYNAMIC_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetTypeReference> DYNAMIC_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
|
||||||
|
|||||||
-1
@@ -331,7 +331,6 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(ABSTRACT_SUPER_CALL, "Abstract member cannot be accessed directly");
|
MAP.put(ABSTRACT_SUPER_CALL, "Abstract member cannot be accessed directly");
|
||||||
MAP.put(NOT_A_SUPERTYPE, "Not a supertype");
|
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(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(USELESS_CAST, "No cast needed");
|
||||||
MAP.put(CAST_NEVER_SUCCEEDS, "This cast can never succeed");
|
MAP.put(CAST_NEVER_SUCCEEDS, "This cast can never succeed");
|
||||||
MAP.put(DYNAMIC_NOT_ALLOWED, "Dynamic types are not allowed in this position");
|
MAP.put(DYNAMIC_NOT_ALLOWED, "Dynamic types are not allowed in this position");
|
||||||
|
|||||||
@@ -241,7 +241,6 @@ public interface JetTokens {
|
|||||||
MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR,
|
MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR,
|
||||||
SAFE_ACCESS, ELVIS,
|
SAFE_ACCESS, ELVIS,
|
||||||
// MAP, FILTER,
|
// MAP, FILTER,
|
||||||
COLON,
|
|
||||||
RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ,
|
RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ,
|
||||||
NOT_IN, NOT_IS,
|
NOT_IN, NOT_IS,
|
||||||
IDENTIFIER);
|
IDENTIFIER);
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
COLON_AS(COLON, AS_KEYWORD, AS_SAFE) {
|
AS(AS_KEYWORD, AS_SAFE) {
|
||||||
@Override
|
@Override
|
||||||
public JetNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) {
|
public JetNodeType parseRightHandSide(IElementType operation, JetExpressionParsing parser) {
|
||||||
parser.myJetParsing.parseTypeRef();
|
parser.myJetParsing.parseTypeRef();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.psi;
|
package org.jetbrains.kotlin.psi;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
@@ -72,54 +71,14 @@ public class JetPsiUtil {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetExpression safeDeparenthesize(@NotNull JetExpression expression) {
|
public static JetExpression safeDeparenthesize(@NotNull JetExpression expression) {
|
||||||
return safeDeparenthesize(expression, true);
|
JetExpression deparenthesized = deparenthesize(expression);
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static JetExpression safeDeparenthesize(@NotNull JetExpression expression, boolean deparenthesizeBinaryExpressionWithTypeRHS) {
|
|
||||||
JetExpression deparenthesized = deparenthesize(expression, deparenthesizeBinaryExpressionWithTypeRHS);
|
|
||||||
return deparenthesized != null ? deparenthesized : expression;
|
return deparenthesized != null ? deparenthesized : expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JetExpression deparenthesize(@Nullable JetExpression expression) {
|
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<JetTypeReference, Void> typeResolutionStrategy
|
|
||||||
) {
|
|
||||||
return deparenthesizeWithResolutionStrategy(expression, true, typeResolutionStrategy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private static JetExpression deparenthesizeWithResolutionStrategy(
|
|
||||||
@Nullable JetExpression expression,
|
|
||||||
boolean deparenthesizeBinaryExpressionWithTypeRHS,
|
|
||||||
@Nullable Function<JetTypeReference, Void> typeResolutionStrategy
|
|
||||||
) {
|
|
||||||
while (true) {
|
while (true) {
|
||||||
JetExpression baseExpression =
|
JetExpression baseExpression = deparenthesizeOnce(expression);
|
||||||
deparenthesizeOnce(expression, deparenthesizeBinaryExpressionWithTypeRHS, typeResolutionStrategy);
|
|
||||||
|
|
||||||
if (baseExpression == expression) return baseExpression;
|
if (baseExpression == expression) return baseExpression;
|
||||||
expression = baseExpression;
|
expression = baseExpression;
|
||||||
@@ -127,24 +86,10 @@ public class JetPsiUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static JetExpression deparenthesizeOnce(
|
public static JetExpression deparenthesizeOnce(
|
||||||
@Nullable JetExpression expression,
|
@Nullable JetExpression expression
|
||||||
boolean deparenthesizeBinaryExpressionWithTypeRHS,
|
|
||||||
@Nullable Function<JetTypeReference, Void> typeResolutionStrategy
|
|
||||||
) {
|
) {
|
||||||
if (deparenthesizeBinaryExpressionWithTypeRHS && expression instanceof JetBinaryExpressionWithTypeRHS) {
|
if (expression instanceof JetAnnotatedExpression) {
|
||||||
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) {
|
|
||||||
return ((JetAnnotatedExpression) expression).getBaseExpression();
|
return ((JetAnnotatedExpression) expression).getBaseExpression();
|
||||||
}
|
}
|
||||||
else if (expression instanceof JetLabeledExpression) {
|
else if (expression instanceof JetLabeledExpression) {
|
||||||
@@ -893,7 +838,7 @@ public class JetPsiUtil {
|
|||||||
@Nullable JetExpression expression,
|
@Nullable JetExpression expression,
|
||||||
@NotNull StatementFilter statementFilter
|
@NotNull StatementFilter statementFilter
|
||||||
) {
|
) {
|
||||||
JetExpression deparenthesizedExpression = JetPsiUtil.deparenthesize(expression, false);
|
JetExpression deparenthesizedExpression = deparenthesize(expression);
|
||||||
if (deparenthesizedExpression instanceof JetBlockExpression) {
|
if (deparenthesizedExpression instanceof JetBlockExpression) {
|
||||||
JetBlockExpression blockExpression = (JetBlockExpression) deparenthesizedExpression;
|
JetBlockExpression blockExpression = (JetBlockExpression) deparenthesizedExpression;
|
||||||
// todo
|
// todo
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class DelegatedPropertyResolver {
|
|||||||
return psiFactory.createExpression(builtIns.getPropertyMetadataImpl().getName().asString() +
|
return psiFactory.createExpression(builtIns.getPropertyMetadataImpl().getName().asString() +
|
||||||
"(\"" +
|
"(\"" +
|
||||||
propertyDescriptor.getName().asString() +
|
propertyDescriptor.getName().asString() +
|
||||||
"\"): " +
|
"\") as " +
|
||||||
builtIns.getPropertyMetadata().getName().asString());
|
builtIns.getPropertyMetadata().getName().asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
|||||||
import org.jetbrains.kotlin.types.JetType
|
import org.jetbrains.kotlin.types.JetType
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.types.expressions.DataFlowAnalyzer
|
import org.jetbrains.kotlin.types.expressions.DataFlowAnalyzer
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
public class CallCompleter(
|
public class CallCompleter(
|
||||||
private val argumentTypeResolver: ArgumentTypeResolver,
|
private val argumentTypeResolver: ArgumentTypeResolver,
|
||||||
@@ -297,7 +297,7 @@ public class CallCompleter(
|
|||||||
if ((!ErrorUtils.containsErrorType(recordedType) && recordedType == updatedType) || updatedType == null) return updatedType
|
if ((!ErrorUtils.containsErrorType(recordedType) && recordedType == updatedType) || updatedType == null) return updatedType
|
||||||
|
|
||||||
fun deparenthesizeOrGetSelector(expression: JetExpression?): JetExpression? {
|
fun deparenthesizeOrGetSelector(expression: JetExpression?): JetExpression? {
|
||||||
val deparenthesized = JetPsiUtil.deparenthesizeOnce(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ false)
|
val deparenthesized = JetPsiUtil.deparenthesizeOnce(expression)
|
||||||
if (deparenthesized != expression) return deparenthesized
|
if (deparenthesized != expression) return deparenthesized
|
||||||
|
|
||||||
if (expression is JetQualifiedExpression) return expression.getSelectorExpression()
|
if (expression is JetQualifiedExpression) return expression.getSelectorExpression()
|
||||||
|
|||||||
+1
-1
@@ -443,7 +443,7 @@ public class CallExpressionResolver {
|
|||||||
) {
|
) {
|
||||||
if (qualifierReceiver == null) return;
|
if (qualifierReceiver == null) return;
|
||||||
JetExpression calleeExpression =
|
JetExpression calleeExpression =
|
||||||
JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()), false);
|
JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()));
|
||||||
DeclarationDescriptor selectorDescriptor =
|
DeclarationDescriptor selectorDescriptor =
|
||||||
calleeExpression instanceof JetReferenceExpression
|
calleeExpression instanceof JetReferenceExpression
|
||||||
? context.trace.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression) : null;
|
? context.trace.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression) : null;
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ public class CandidateResolver(
|
|||||||
expectedType: JetType,
|
expectedType: JetType,
|
||||||
actualType: JetType,
|
actualType: JetType,
|
||||||
context: ResolutionContext<*>): 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)
|
val variants = smartCastManager.getSmartCastVariantsExcludingReceiver(context, receiverToCast)
|
||||||
for (possibleType in variants) {
|
for (possibleType in variants) {
|
||||||
if (JetTypeChecker.DEFAULT.isSubtypeOf(possibleType, expectedType)) {
|
if (JetTypeChecker.DEFAULT.isSubtypeOf(possibleType, expectedType)) {
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class DynamicCallableDescriptors(private val builtIns: KotlinBuiltIns) {
|
|||||||
val varargElementType: JetType?
|
val varargElementType: JetType?
|
||||||
var hasSpreadOperator = false
|
var hasSpreadOperator = false
|
||||||
|
|
||||||
val argExpression = JetPsiUtil.deparenthesize(arg.getArgumentExpression(), false)
|
val argExpression = JetPsiUtil.deparenthesize(arg.getArgumentExpression())
|
||||||
|
|
||||||
when {
|
when {
|
||||||
argExpression is JetFunctionLiteralExpression -> {
|
argExpression is JetFunctionLiteralExpression -> {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ private fun List<ValueArgument?>.filterArgsInParentheses() = filter { it !is Jet
|
|||||||
|
|
||||||
public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueArgument? {
|
public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueArgument? {
|
||||||
fun JetElement.deparenthesizeStructurally(): JetElement? {
|
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 {
|
return when {
|
||||||
deparenthesized != this -> deparenthesized
|
deparenthesized != this -> deparenthesized
|
||||||
this is JetFunctionLiteralExpression -> this.getFunctionLiteral()
|
this is JetFunctionLiteralExpression -> this.getFunctionLiteral()
|
||||||
@@ -105,7 +105,7 @@ public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueA
|
|||||||
// Get call / resolved call from binding context
|
// Get call / resolved call from binding context
|
||||||
|
|
||||||
public fun JetElement?.getCalleeExpressionIfAny(): JetExpression? {
|
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) {
|
return when (element) {
|
||||||
is JetSimpleNameExpression -> element
|
is JetSimpleNameExpression -> element
|
||||||
is JetCallElement -> element.getCalleeExpression()
|
is JetCallElement -> element.getCalleeExpression()
|
||||||
@@ -127,8 +127,8 @@ public fun JetElement.getCall(context: BindingContext): Call? {
|
|||||||
if (element == null) return null
|
if (element == null) return null
|
||||||
|
|
||||||
val parent = element.getParent()
|
val parent = element.getParent()
|
||||||
val reference = when {
|
val reference: JetExpression? = when {
|
||||||
parent is JetInstanceExpressionWithLabel -> parent : JetInstanceExpressionWithLabel
|
parent is JetInstanceExpressionWithLabel -> parent
|
||||||
parent is JetUserType -> parent.getParent()?.getParent() as? JetConstructorCalleeExpression
|
parent is JetUserType -> parent.getParent()?.getParent() as? JetConstructorCalleeExpression
|
||||||
else -> element.getCalleeExpressionIfAny()
|
else -> element.getCalleeExpressionIfAny()
|
||||||
}
|
}
|
||||||
|
|||||||
-15
@@ -172,17 +172,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
TypeResolutionContext typeResolutionContext = new TypeResolutionContext(context.scope, context.trace, true, allowBareTypes);
|
TypeResolutionContext typeResolutionContext = new TypeResolutionContext(context.scope, context.trace, true, allowBareTypes);
|
||||||
PossiblyBareType possiblyBareTarget = components.typeResolver.resolvePossiblyBareType(typeResolutionContext, right);
|
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);
|
JetTypeInfo typeInfo = facade.getTypeInfo(left, contextWithNoExpectedType);
|
||||||
|
|
||||||
JetType subjectType = typeInfo.getType();
|
JetType subjectType = typeInfo.getType();
|
||||||
@@ -210,10 +199,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
if (actualType == null) return;
|
if (actualType == null) return;
|
||||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
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) {
|
if (operationType != JetTokens.AS_KEYWORD && operationType != JetTokens.AS_SAFE) {
|
||||||
context.trace.report(UNSUPPORTED.on(operationSign, "binary operation with type RHS"));
|
context.trace.report(UNSUPPORTED.on(operationSign, "binary operation with type RHS"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ public class DataFlowAnalyzer {
|
|||||||
hasError.set(false);
|
hasError.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
JetExpression expression = JetPsiUtil.safeDeparenthesize(expressionToCheck, false);
|
JetExpression expression = JetPsiUtil.safeDeparenthesize(expressionToCheck);
|
||||||
recordExpectedType(c.trace, expression, c.expectedType);
|
recordExpectedType(c.trace, expression, c.expectedType);
|
||||||
|
|
||||||
if (expressionType == null) return null;
|
if (expressionType == null) return null;
|
||||||
|
|||||||
+1
-1
@@ -224,7 +224,7 @@ public class ExpressionTypingUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean dependsOnExpectedType(@Nullable JetExpression expression) {
|
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 == null) return false;
|
||||||
|
|
||||||
if (expr instanceof JetBinaryExpressionWithTypeRHS) {
|
if (expr instanceof JetBinaryExpressionWithTypeRHS) {
|
||||||
|
|||||||
+3
-10
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.types.expressions;
|
package org.jetbrains.kotlin.types.expressions;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -51,7 +50,7 @@ import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPac
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
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.AMBIGUOUS_REFERENCE_TARGET;
|
||||||
import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE_REASSIGNMENT;
|
import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE_REASSIGNMENT;
|
||||||
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
|
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
|
||||||
@@ -246,7 +245,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
JetType leftType = leftInfo.getType();
|
JetType leftType = leftInfo.getType();
|
||||||
|
|
||||||
JetExpression right = expression.getRight();
|
JetExpression right = expression.getRight();
|
||||||
JetExpression left = leftOperand == null ? null : JetPsiUtil.deparenthesize(leftOperand);
|
JetExpression left = leftOperand == null ? null : deparenthesize(leftOperand);
|
||||||
if (right == null || left == null) {
|
if (right == null || left == null) {
|
||||||
temporary.commit();
|
temporary.commit();
|
||||||
return leftInfo.clearType();
|
return leftInfo.clearType();
|
||||||
@@ -341,13 +340,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
scope, ((JetAnnotatedExpression) leftOperand).getAnnotationEntries(), context.trace
|
scope, ((JetAnnotatedExpression) leftOperand).getAnnotationEntries(), context.trace
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
JetExpression left = deparenthesizeWithResolutionStrategy(leftOperand, new Function<JetTypeReference, Void>() {
|
JetExpression left = deparenthesize(leftOperand);
|
||||||
@Override
|
|
||||||
public Void apply(JetTypeReference reference) {
|
|
||||||
components.typeResolver.resolveType(context.scope, reference, context.trace, true);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
JetExpression right = expression.getRight();
|
JetExpression right = expression.getRight();
|
||||||
if (left instanceof JetArrayAccessExpression) {
|
if (left instanceof JetArrayAccessExpression) {
|
||||||
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
|
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class LabelResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JetExpression getExpressionUnderLabel(@NotNull JetExpression labeledExpression) {
|
private JetExpression getExpressionUnderLabel(@NotNull JetExpression labeledExpression) {
|
||||||
JetExpression expression = JetPsiUtil.safeDeparenthesize(labeledExpression, true);
|
JetExpression expression = JetPsiUtil.safeDeparenthesize(labeledExpression);
|
||||||
if (expression instanceof JetFunctionLiteralExpression) {
|
if (expression instanceof JetFunctionLiteralExpression) {
|
||||||
return ((JetFunctionLiteralExpression) expression).getFunctionLiteral();
|
return ((JetFunctionLiteralExpression) expression).getFunctionLiteral();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
assert subjectType != null;
|
assert subjectType != null;
|
||||||
if (TypeUtils.isNullableType(subjectType) && !WhenChecker.containsNullCase(expression, context.trace)) {
|
if (TypeUtils.isNullableType(subjectType) && !WhenChecker.containsNullCase(expression, context.trace)) {
|
||||||
ExpressionTypingContext subjectContext = context.replaceExpectedType(TypeUtils.makeNotNullable(subjectType));
|
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());
|
context = context.replaceDataFlowInfo(typeInfo.getDataFlowInfo());
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-13
@@ -1,6 +1,5 @@
|
|||||||
== foo ==
|
== foo ==
|
||||||
fun foo(a: Any) {
|
fun foo(a: Any) {
|
||||||
a : String
|
|
||||||
a as String
|
a as String
|
||||||
a as? String
|
a as? String
|
||||||
}
|
}
|
||||||
@@ -10,20 +9,17 @@ L0:
|
|||||||
v(a: Any)
|
v(a: Any)
|
||||||
magic[FAKE_INITIALIZER](a: Any) -> <v0>
|
magic[FAKE_INITIALIZER](a: Any) -> <v0>
|
||||||
w(a|<v0>)
|
w(a|<v0>)
|
||||||
2 mark({ a : String a as String a as? String })
|
2 mark({ a as String a as? String })
|
||||||
mark(a : String)
|
|
||||||
r(a) -> <v1>
|
|
||||||
magic[CAST](a : String|<v1>) -> <v2>
|
|
||||||
mark(a as String)
|
mark(a as String)
|
||||||
r(a) -> <v3>
|
r(a) -> <v1>
|
||||||
magic[CAST](a as String|<v3>) -> <v4>
|
magic[CAST](a as String|<v1>) -> <v2>
|
||||||
mark(a as? String)
|
mark(a as? String)
|
||||||
r(a) -> <v5>
|
r(a) -> <v3>
|
||||||
magic[CAST](a as? String|<v5>) -> <v6>
|
magic[CAST](a as? String|<v3>) -> <v4>
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
<SINK> PREV:[<ERROR>, <END>]
|
||||||
=====================
|
=====================
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
fun foo(a: Any) {
|
fun foo(a: Any) {
|
||||||
a : String
|
|
||||||
a as String
|
a as String
|
||||||
a as? String
|
a as? String
|
||||||
}
|
}
|
||||||
+6
-9
@@ -1,16 +1,13 @@
|
|||||||
== foo ==
|
== foo ==
|
||||||
fun foo(a: Any) {
|
fun foo(a: Any) {
|
||||||
a : String
|
|
||||||
a as String
|
a as String
|
||||||
a as? String
|
a as? String
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> <v0>
|
<v0>: {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> <v0>
|
||||||
a <v1>: * NEW: r(a) -> <v1>
|
a <v1>: * NEW: r(a) -> <v1>
|
||||||
a : String <v2>: * NEW: magic[CAST](a : String|<v1>) -> <v2>
|
a as String <v2>: * NEW: magic[CAST](a as String|<v1>) -> <v2>
|
||||||
a <v3>: * NEW: r(a) -> <v3>
|
a <v3>: * NEW: r(a) -> <v3>
|
||||||
a as String <v4>: * NEW: magic[CAST](a as String|<v3>) -> <v4>
|
a as? String <v4>: * NEW: magic[CAST](a as? String|<v3>) -> <v4>
|
||||||
a <v5>: * NEW: r(a) -> <v5>
|
{ a as String a as? String } <v4>: * COPY
|
||||||
a as? String <v6>: * NEW: magic[CAST](a as? String|<v5>) -> <v6>
|
|
||||||
{ a : String a as String a as? String } <v6>: * COPY
|
|
||||||
=====================
|
=====================
|
||||||
@@ -15,8 +15,11 @@ class E : C(), D
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val e = E()
|
val e = E()
|
||||||
if (e.foo() != 222) return "Fail 1"
|
if (e.foo() != 222) return "Fail 1"
|
||||||
if ((e : D).foo() != 222) return "Fail 2"
|
val d: D = e
|
||||||
if ((e : C).foo() != 222) return "Fail 3"
|
val c: C = e
|
||||||
if ((e : A).foo() != 222) return "Fail 4"
|
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"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,13 @@ class E : D, C()
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val e = E()
|
val e = E()
|
||||||
var r = e.foo()[0]
|
var r = e.foo()[0]
|
||||||
r += (e : D).foo().iterator().next()
|
val d: D = e
|
||||||
r += (e : C).foo()[0]
|
val c: C = e
|
||||||
r += (e : B).foo()[0]
|
val b: B = e
|
||||||
r += (e : A).foo()[0]
|
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"
|
return if (r == "BBBBB") "OK" else "Fail: $r"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -8,4 +8,7 @@ class B : A<String> {
|
|||||||
|
|
||||||
class C(a: A<String>) : A<String> by a
|
class C(a: A<String>) : A<String> by a
|
||||||
|
|
||||||
fun box() = (C(B()) : A<String>).foo()
|
fun box(): String {
|
||||||
|
val a: A<String> = C(B())
|
||||||
|
return a.foo()
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ fun box(): String {
|
|||||||
val b: A<String> = B(o)
|
val b: A<String> = B(o)
|
||||||
b.result = "OK"
|
b.result = "OK"
|
||||||
if (b.result != "OK") return "Fail"
|
if (b.result != "OK") return "Fail"
|
||||||
return (b : A<String>).result
|
return b.result
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-4
@@ -13,11 +13,14 @@ class Z : B<Int>, C<String> {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val c: C<String> = z
|
||||||
|
val b: B<Int> = z
|
||||||
|
val a: A<String, Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("", 0) != "Z" -> "Fail #1"
|
z.foo("", 0) != "Z" -> "Fail #1"
|
||||||
(z : C<String>).foo("", 0) != "Z" -> "Fail #2"
|
c.foo("", 0) != "Z" -> "Fail #2"
|
||||||
(z : B<Int>).foo("", 0) != "Z" -> "Fail #3"
|
b.foo("", 0) != "Z" -> "Fail #3"
|
||||||
(z : A<String, Int>).foo("", 0) != "Z" -> "Fail #4"
|
a.foo("", 0) != "Z" -> "Fail #4"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-6
@@ -13,14 +13,18 @@ class Z2 : B, A<Int>
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z1 = Z1()
|
val z1 = Z1()
|
||||||
val z2 = Z2()
|
val z2 = Z2()
|
||||||
|
val z1a: A<Int> = z1
|
||||||
|
val z1b: B = z1
|
||||||
|
val z2a: A<Int> = z2
|
||||||
|
val z2b: B = z2
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
z1.foo( 0) != "B" -> "Fail #1"
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
z1a.foo( 0) != "B" -> "Fail #2"
|
||||||
(z1 : B).foo( 0) != "B" -> "Fail #3"
|
z1b.foo( 0) != "B" -> "Fail #3"
|
||||||
z2.foo( 0) != "B" -> "Fail #4"
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
z2a.foo( 0) != "B" -> "Fail #5"
|
||||||
(z2 : B).foo( 0) != "B" -> "Fail #6"
|
z2b.foo( 0) != "B" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-6
@@ -13,14 +13,18 @@ class Z2 : B<Int>, A<Int>
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z1 = Z1()
|
val z1 = Z1()
|
||||||
val z2 = Z2()
|
val z2 = Z2()
|
||||||
|
val z1a: A<Int> = z1
|
||||||
|
val z1b: B<Int> = z1
|
||||||
|
val z2a: A<Int> = z2
|
||||||
|
val z2b: B<Int> = z2
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
z1.foo( 0) != "B" -> "Fail #1"
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
z1a.foo( 0) != "B" -> "Fail #2"
|
||||||
(z1 : B<Int>).foo( 0) != "B" -> "Fail #3"
|
z1b.foo( 0) != "B" -> "Fail #3"
|
||||||
z2.foo( 0) != "B" -> "Fail #4"
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
z2a.foo( 0) != "B" -> "Fail #5"
|
||||||
(z2 : B<Int>).foo( 0) != "B" -> "Fail #6"
|
z2b.foo( 0) != "B" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,9 @@ class Foo: Class(), Trait<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
val t: Trait<String> = Foo()
|
||||||
try {
|
try {
|
||||||
(Foo() : Trait<String>).f()
|
t.f()
|
||||||
} catch (e: UnsupportedOperationException) {
|
} catch (e: UnsupportedOperationException) {
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-6
@@ -15,14 +15,18 @@ class Z2 : B by Z(), A<Int>
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z1 = Z1()
|
val z1 = Z1()
|
||||||
val z2 = Z2()
|
val z2 = Z2()
|
||||||
|
val z1a: A<Int> = z1
|
||||||
|
val z1b: B = z1
|
||||||
|
val z2a: A<Int> = z2
|
||||||
|
val z2b: B = z2
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
z1.foo( 0) != "B" -> "Fail #1"
|
z1.foo( 0) != "B" -> "Fail #1"
|
||||||
(z1 : A<Int>).foo( 0) != "B" -> "Fail #2"
|
z1a.foo( 0) != "B" -> "Fail #2"
|
||||||
(z1 : B).foo( 0) != "B" -> "Fail #3"
|
z1b.foo( 0) != "B" -> "Fail #3"
|
||||||
z2.foo( 0) != "B" -> "Fail #4"
|
z2.foo( 0) != "B" -> "Fail #4"
|
||||||
(z2 : A<Int>).foo( 0) != "B" -> "Fail #5"
|
z2a.foo( 0) != "B" -> "Fail #5"
|
||||||
(z2 : B).foo( 0) != "B" -> "Fail #6"
|
z2b.foo( 0) != "B" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-2
@@ -17,7 +17,9 @@ class C : A, B()
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = C()
|
val c = C()
|
||||||
c.foo = "1"
|
c.foo = "1"
|
||||||
(c : B).foo = "2"
|
val b: B = c
|
||||||
(c : A).foo = "3"
|
val a: A = c
|
||||||
|
b.foo = "2"
|
||||||
|
a.foo = "3"
|
||||||
return if (result == "123") "OK" else "Fail: $result"
|
return if (result == "123") "OK" else "Fail: $result"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,11 @@ class D4 : D3
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val x = D4()
|
val x = D4()
|
||||||
x.foo()
|
x.foo()
|
||||||
(x : D3).foo()
|
val d3: D3 = x
|
||||||
(x : F2).foo()
|
val f2: F2 = x
|
||||||
(x : D1).foo()
|
val d1: D1 = x
|
||||||
|
d3.foo()
|
||||||
|
f2.foo()
|
||||||
|
d1.foo()
|
||||||
return if (result == "D3D3D3D3") "OK" else "Fail: $result"
|
return if (result == "D3D3D3D3") "OK" else "Fail: $result"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -11,8 +11,10 @@ class C : A, B
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = C()
|
val c = C()
|
||||||
var result = ""
|
var result = ""
|
||||||
|
val b: B = c
|
||||||
|
val a: A = c
|
||||||
result += c.foo()
|
result += c.foo()
|
||||||
result += (c : B).foo()
|
result += b.foo()
|
||||||
result += (c : A).foo()
|
result += a.foo()
|
||||||
return if (result == "AAA") "OK" else "Fail: $result"
|
return if (result == "AAA") "OK" else "Fail: $result"
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-4
@@ -17,9 +17,14 @@ class F5 : F3, D4()
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = F5()
|
val z = F5()
|
||||||
var result = z.foo()
|
var result = z.foo()
|
||||||
result += (z : D4).foo()
|
val d4: D4 = z
|
||||||
result += (z : F3).foo() as Int
|
val f3: F3 = z
|
||||||
result += (z : D2).foo() as Int
|
val d2: D2 = z
|
||||||
result += (z : D1).foo() as Int
|
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"
|
return if (result == 5 * 42) "OK" else "Fail: $result"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -10,7 +10,9 @@ class C(value: String) : A(value), B
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = C("OK")
|
val c = C("OK")
|
||||||
if ((c : B).component1() != "OK") return "Fail 1"
|
val b: B = c
|
||||||
if ((c : A).component1() != "OK") return "Fail 2"
|
val a: A = c
|
||||||
|
if (b.component1() != "OK") return "Fail 1"
|
||||||
|
if (a.component1() != "OK") return "Fail 2"
|
||||||
return c.component1()
|
return c.component1()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -13,7 +13,9 @@ fun box(): String {
|
|||||||
val myStringList = StringList()
|
val myStringList = StringList()
|
||||||
myStringList.add("first element")
|
myStringList.add("first element")
|
||||||
if (myStringList.get(0) != "StringList.get()") return "Fail #1"
|
if (myStringList.get(0) != "StringList.get()") return "Fail #1"
|
||||||
if ((myStringList: BaseStringList).get(0) != "StringList.get()") return "Fail #2"
|
val b: BaseStringList = myStringList
|
||||||
if ((myStringList: ArrayList<String>).get(0) != "StringList.get()") return "Fail #3"
|
val a: ArrayList<String> = myStringList
|
||||||
|
if (b.get(0) != "StringList.get()") return "Fail #2"
|
||||||
|
if (a.get(0) != "StringList.get()") return "Fail #3"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@ class B : A<Child> {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val b = B()
|
val b = B()
|
||||||
b.foo(Child())
|
b.foo(Child())
|
||||||
(b : A<Child>).foo(Child())
|
val a: A<Child> = b
|
||||||
|
a.foo(Child())
|
||||||
return if (result == "BB") "OK" else "Fail: $result"
|
return if (result == "BB") "OK" else "Fail: $result"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,16 @@ class Z : D() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val d: D = z
|
||||||
|
val c: C = z
|
||||||
|
val b: B<String> = z
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("") != "Z" -> "Fail #1"
|
z.foo("") != "Z" -> "Fail #1"
|
||||||
(z : D).foo("") != "Z" -> "Fail #2"
|
d.foo("") != "Z" -> "Fail #2"
|
||||||
(z : C).foo("") != "Z" -> "Fail #3"
|
c.foo("") != "Z" -> "Fail #3"
|
||||||
(z : B<String>).foo("") != "Z" -> "Fail #4"
|
b.foo("") != "Z" -> "Fail #4"
|
||||||
(z : A<String>).foo("") != "Z" -> "Fail #5"
|
a.foo("") != "Z" -> "Fail #5"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-4
@@ -13,11 +13,14 @@ class Z : C<Double>() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val c: C<Double> = z
|
||||||
|
val b: B<String, Double> = z
|
||||||
|
val a: A<String, Int, Double> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("", 0, 0.0) != "Z" -> "Fail #1"
|
z.foo("", 0, 0.0) != "Z" -> "Fail #1"
|
||||||
(z : C<Double>).foo("", 0, 0.0) != "Z" -> "Fail #2"
|
c.foo("", 0, 0.0) != "Z" -> "Fail #2"
|
||||||
(z : B<String, Double>).foo("", 0, 0.0) != "Z" -> "Fail #3"
|
b.foo("", 0, 0.0) != "Z" -> "Fail #3"
|
||||||
(z : A<String, Int, Double>).foo("", 0, 0.0) != "Z" -> "Fail #4"
|
a.foo("", 0, 0.0) != "Z" -> "Fail #4"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ class Z<T> : A<T, Int> {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z<Int>()
|
val z = Z<Int>()
|
||||||
|
val a: A<Int, Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo(0, 0) != "Z" -> "Fail #1"
|
z.foo(0, 0) != "Z" -> "Fail #1"
|
||||||
(z : A<Int, Int>).foo(0, 0) != "Z" -> "Fail #2"
|
a.foo(0, 0) != "Z" -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -16,7 +16,9 @@ class C : B {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = C()
|
val c = C()
|
||||||
var r = c.foo().iterator().next()
|
var r = c.foo().iterator().next()
|
||||||
r += (c : B).foo().iterator().next()
|
val b: B = c
|
||||||
r += (c : A).foo().iterator().next()
|
val a: A = c
|
||||||
|
r += b.foo().iterator().next()
|
||||||
|
r += a.foo().iterator().next()
|
||||||
return if (r == "CCC") "OK" else "Fail: $r"
|
return if (r == "CCC") "OK" else "Fail: $r"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -13,7 +13,8 @@ fun box(): String {
|
|||||||
"Fail 1"
|
"Fail 1"
|
||||||
} catch (e: AssertionError) {
|
} catch (e: AssertionError) {
|
||||||
try {
|
try {
|
||||||
(B() : HashSet<String>).clone()
|
val hs: HashSet<String> = B()
|
||||||
|
hs.clone()
|
||||||
"Fail 2"
|
"Fail 2"
|
||||||
} catch (e: AssertionError) {
|
} catch (e: AssertionError) {
|
||||||
"OK"
|
"OK"
|
||||||
|
|||||||
+3
-2
@@ -9,9 +9,10 @@ class Z : A<String>() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("") != "Z" -> "Fail #1"
|
z.foo("") != "Z" -> "Fail #1"
|
||||||
(z : A<String>).foo("") != "Z" -> "Fail #2"
|
a.foo("") != "Z" -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -11,10 +11,10 @@ enum class Z(val name: String) : A<String> {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return when {
|
return when {
|
||||||
Z.Z1.foo("") != "Z1" -> "Fail #1"
|
Z.Z1.foo("") != "Z1" -> "Fail #1"
|
||||||
Z.Z2.foo("") != "Z2" -> "Fail #2"
|
Z.Z2.foo("") != "Z2" -> "Fail #2"
|
||||||
(Z.Z1 : A<String>).foo("") != "Z1" -> "Fail #3"
|
(Z.Z1 as A<String>).foo("") != "Z1" -> "Fail #3"
|
||||||
(Z.Z2 : A<String>).foo("") != "Z2" -> "Fail #4"
|
(Z.Z2 as A<String>).foo("") != "Z2" -> "Fail #4"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ class Z : A<String>() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("", 0) != "Z" -> "Fail #1"
|
z.foo("", 0) != "Z" -> "Fail #1"
|
||||||
(z : A<String>).foo("", 0) != "Z" -> "Fail #2"
|
a.foo("", 0) != "Z" -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -11,11 +11,13 @@ fun box(): String {
|
|||||||
val z = object : A<String>() {
|
val z = object : A<String>() {
|
||||||
override fun foo(t: String) = "z"
|
override fun foo(t: String) = "z"
|
||||||
}
|
}
|
||||||
|
val az: A<String> = Z
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
Z.foo("") != "Z" -> "Fail #1"
|
Z.foo("") != "Z" -> "Fail #1"
|
||||||
z.foo("") != "z" -> "Fail #2"
|
z.foo("") != "z" -> "Fail #2"
|
||||||
(Z : A<String>).foo("") != "Z" -> "Fail #3"
|
az.foo("") != "Z" -> "Fail #3"
|
||||||
(z : A<String>).foo("") != "z" -> "Fail #4"
|
a.foo("") != "z" -> "Fail #4"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ class Z : A<Int>(17) {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo() != 239 -> "Fail #1"
|
z.foo() != 239 -> "Fail #1"
|
||||||
(z : A<Int>).foo() != 239 -> "Fail #2"
|
a.foo() != 239 -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ class Z : A<String>
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("") != "A" -> "Fail #1"
|
z.foo("") != "A" -> "Fail #1"
|
||||||
(z : A<String>).foo("") != "A" -> "Fail #2"
|
a.foo("") != "A" -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ class Z : A<Int>() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo(0) != "Z" -> "Fail #1"
|
z.foo(0) != "Z" -> "Fail #1"
|
||||||
(z : A<Int>).foo(0) != "Z" -> "Fail #2"
|
a.foo(0) != "Z" -> "Fail #2"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -11,10 +11,12 @@ class Z : B() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val b: B = z
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("") != "Z" -> "Fail #1"
|
z.foo("") != "Z" -> "Fail #1"
|
||||||
(z : B).foo("") != "Z" -> "Fail #2"
|
b.foo("") != "Z" -> "Fail #2"
|
||||||
(z : A<String>).foo("") != "Z" -> "Fail #3"
|
a.foo("") != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -10,10 +10,12 @@ class Z : B() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val b: B = z
|
||||||
|
val a: A<Int, Number> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo(0, 0) != "Z" -> "Fail #1"
|
z.foo(0, 0) != "Z" -> "Fail #1"
|
||||||
(z : B).foo(0, 0) != "Z" -> "Fail #2"
|
b.foo(0, 0) != "Z" -> "Fail #2"
|
||||||
(z : A<Int, Number>).foo(0, 0) != "Z" -> "Fail #3"
|
a.foo(0, 0) != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -13,5 +13,6 @@ class D : A<String> by C()
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val d = D()
|
val d = D()
|
||||||
if (d.id("") != "") return "Fail"
|
if (d.id("") != "") return "Fail"
|
||||||
return (d : A<String>).id("OK")
|
val a: A<String> = d
|
||||||
|
return a.id("OK")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,17 @@ enum class Z(val name: String) : B {
|
|||||||
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
val z1b: B = Z.Z1
|
||||||
|
val z2b: B = Z.Z2
|
||||||
|
val z1a: A<String> = Z.Z1
|
||||||
|
val z2a: A<String> = Z.Z2
|
||||||
return when {
|
return when {
|
||||||
Z.Z1.foo("") != "Z1" -> "Fail #1"
|
Z.Z1.foo("") != "Z1" -> "Fail #1"
|
||||||
Z.Z2.foo("") != "Z2" -> "Fail #2"
|
Z.Z2.foo("") != "Z2" -> "Fail #2"
|
||||||
(Z.Z1 : B).foo("") != "Z1" -> "Fail #3"
|
z1b.foo("") != "Z1" -> "Fail #3"
|
||||||
(Z.Z2 : B).foo("") != "Z2" -> "Fail #4"
|
z2b.foo("") != "Z2" -> "Fail #4"
|
||||||
(Z.Z1 : A<String>).foo("") != "Z1" -> "Fail #5"
|
z1a.foo("") != "Z1" -> "Fail #5"
|
||||||
(Z.Z2 : A<String>).foo("") != "Z2" -> "Fail #6"
|
z2a.foo("") != "Z2" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -11,10 +11,12 @@ class Z : B() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val b: B = z
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("", 0) != "Z" -> "Fail #1"
|
z.foo("", 0) != "Z" -> "Fail #1"
|
||||||
(z : B).foo("", 0) != "Z" -> "Fail #2"
|
b.foo("", 0) != "Z" -> "Fail #2"
|
||||||
(z : A<String>).foo("", 0) != "Z" -> "Fail #3"
|
a.foo("", 0) != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,18 @@ fun box(): String {
|
|||||||
val o = object : B() {
|
val o = object : B() {
|
||||||
override fun foo(t: String) = "o"
|
override fun foo(t: String) = "o"
|
||||||
}
|
}
|
||||||
|
val zb: B = Z
|
||||||
|
val ob: B = o
|
||||||
|
val za: A<String> = Z
|
||||||
|
val oa: A<String> = o
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
Z.foo("") != "Z" -> "Fail #1"
|
Z.foo("") != "Z" -> "Fail #1"
|
||||||
o.foo("") != "o" -> "Fail #2"
|
o.foo("") != "o" -> "Fail #2"
|
||||||
(Z : B).foo("") != "Z" -> "Fail #3"
|
zb.foo("") != "Z" -> "Fail #3"
|
||||||
(o : B).foo("") != "o" -> "Fail #4"
|
ob.foo("") != "o" -> "Fail #4"
|
||||||
(Z : A<String>).foo("") != "Z" -> "Fail #5"
|
za.foo("") != "Z" -> "Fail #5"
|
||||||
(o : A<String>).foo("") != "o" -> "Fail #6"
|
oa.foo("") != "o" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ class Z : B() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun box() = (Z() : A<String>).foo
|
fun box(): String {
|
||||||
|
val a: A<String> = Z()
|
||||||
|
return a.foo
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ class Z : B() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val b: B = z
|
||||||
|
val a: A<String> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo("") != "Z" -> "Fail #1"
|
z.foo("") != "Z" -> "Fail #1"
|
||||||
(z : B).foo("") != "Z" -> "Fail #2"
|
b.foo("") != "Z" -> "Fail #2"
|
||||||
(z : A<String>).foo("") != "Z" -> "Fail #3"
|
a.foo("") != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -11,10 +11,12 @@ class Z : B() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val b: B = z
|
||||||
|
val a: A<Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo(0) != "Z" -> "Fail #1"
|
z.foo(0) != "Z" -> "Fail #1"
|
||||||
(z : B).foo(0) != "Z" -> "Fail #2"
|
b.foo(0) != "Z" -> "Fail #2"
|
||||||
(z : A<Int>).foo(0) != "Z" -> "Fail #3"
|
a.foo(0) != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ class C : B
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = C()
|
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"
|
return if (r == "BBB") "OK" else "Fail: $r"
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-6
@@ -17,13 +17,17 @@ class Z2 : B<String, Int>, A<String> {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z1 = Z1()
|
val z1 = Z1()
|
||||||
val z2 = Z2()
|
val z2 = Z2()
|
||||||
|
val z1a: A<String> = z1
|
||||||
|
val z1b: B<String, Int> = z1
|
||||||
|
val z2a: A<String> = z2
|
||||||
|
val z2b: B<String, Int> = z2
|
||||||
return when {
|
return when {
|
||||||
z1.foo("", 0) != "Z1" -> "Fail #1"
|
z1.foo("", 0) != "Z1" -> "Fail #1"
|
||||||
(z1 : A<String>).foo("", 0) != "Z1" -> "Fail #2"
|
z1a.foo("", 0) != "Z1" -> "Fail #2"
|
||||||
(z1 : B<String, Int>).foo("", 0) != "Z1" -> "Fail #3"
|
z1b.foo("", 0) != "Z1" -> "Fail #3"
|
||||||
z2.foo("", 0) != "Z2" -> "Fail #4"
|
z2.foo("", 0) != "Z2" -> "Fail #4"
|
||||||
(z2 : A<String>).foo("", 0) != "Z2" -> "Fail #5"
|
z2a.foo("", 0) != "Z2" -> "Fail #5"
|
||||||
(z2 : B<String, Int>).foo("", 0) != "Z2" -> "Fail #6"
|
z2b.foo("", 0) != "Z2" -> "Fail #6"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -13,10 +13,12 @@ class Z : A<Int>, B<Int> {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val z = Z()
|
val z = Z()
|
||||||
|
val a: A<Int> = z
|
||||||
|
val b: B<Int> = z
|
||||||
return when {
|
return when {
|
||||||
z.foo(0) != "Z" -> "Fail #1"
|
z.foo(0) != "Z" -> "Fail #1"
|
||||||
(z : A<Int>).foo(0) != "Z" -> "Fail #2"
|
a.foo(0) != "Z" -> "Fail #2"
|
||||||
(z : B<Int>).foo(0) != "Z" -> "Fail #3"
|
b.foo(0) != "Z" -> "Fail #3"
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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 {
|
fun box() : String {
|
||||||
val answer = m(5)
|
val answer = m(5)
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ fun box(): String {
|
|||||||
var x = 1
|
var x = 1
|
||||||
(foo@ x)++
|
(foo@ x)++
|
||||||
++(foo@ x)
|
++(foo@ x)
|
||||||
(x: Int)++
|
|
||||||
++(x: Int)
|
|
||||||
|
|
||||||
if (x != 5) return "Fail: $x"
|
if (x != 3) return "Fail: $x"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c = '0': Char?
|
val c: Char? = '0'
|
||||||
c!!.toInt()
|
c!!.toInt()
|
||||||
|
|
||||||
"123456"?.get(0)!!.toInt()
|
"123456"?.get(0)!!.toInt()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
if ((null : Int?)!! == 10) return "Fail #1"
|
if ((null as Int?)!! == 10) return "Fail #1"
|
||||||
return "Fail #2"
|
return "Fail #2"
|
||||||
}
|
}
|
||||||
catch (e: Exception) {
|
catch (e: Exception) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class AImpl : A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun box() : String {
|
public fun box() : String {
|
||||||
(AImpl() : A).v
|
val a: A = AImpl()
|
||||||
|
a.v
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,8 @@ abstract class C {
|
|||||||
fun test(x: Int) {
|
fun test(x: Int) {
|
||||||
if (x == 0) return
|
if (x == 0) return
|
||||||
if (this is D) {
|
if (this is D) {
|
||||||
(this: D).test(x - 1)
|
val d: D = this
|
||||||
|
d.test(x - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ fun box(): String {
|
|||||||
val y = x
|
val y = x
|
||||||
if (!isNullGeneric(y)) return "Fail 3"
|
if (!isNullGeneric(y)) return "Fail 3"
|
||||||
|
|
||||||
if (!deepIsNull((null : Unit?) ?: null)) return "Fail 4"
|
if (!deepIsNull(x ?: null)) return "Fail 4"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -50,8 +50,8 @@ fun box(): String {
|
|||||||
val aZ = BooleanArray(3)
|
val aZ = BooleanArray(3)
|
||||||
|
|
||||||
|
|
||||||
if (barB(*aB, 23: Byte).size() != 4) return "fail: Byte"
|
if (barB(*aB, 23.toByte()).size() != 4) return "fail: Byte"
|
||||||
if (barB(11: Byte, *aB, 23: Byte, *aB).size() != 8) 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(*aC, 'A').size() != 4) return "fail: Char"
|
||||||
if (barC('A', *aC, 'A', *aC).size() != 8) 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, 8, *bI) != "1237845") return "fail: concatParameters 6"
|
||||||
if (concatParameters(*aI, 7, *bI, *aI, 9) != "1237451239") return "fail: concatParameters 7"
|
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, 23L).size() != 4) return "fail: Long"
|
||||||
if (barJ(*aJ, 23: Long, *aJ, *aJ).size() != 10) 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, 23.toShort()).size() != 4) return "fail: Short"
|
||||||
if (barS(*aS, *aS, 23: Short, *aS).size() != 10) 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(*aZ, true).size() != 4) return "fail: Boolean"
|
||||||
if (barZ(false, *aZ, true, *aZ).size() != 8) return "fail: Boolean"
|
if (barZ(false, *aZ, true, *aZ).size() != 8) return "fail: Boolean"
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val sub = Sub()
|
val sub = Sub()
|
||||||
|
val sup: Super = sub
|
||||||
|
|
||||||
(sub : Super).foo{ }
|
sup.foo{ }
|
||||||
if (sub.lastCalled != "super") {
|
if (sub.lastCalled != "super") {
|
||||||
return "FAIL: ${sub.lastCalled} instead of super"
|
return "FAIL: ${sub.lastCalled} instead of super"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ import java.util.Arrays.equals
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val s = arrayOf("live", "long")
|
val s = arrayOf("live", "long")
|
||||||
val t = s.clone()
|
val t: Array<String> = s.clone()
|
||||||
t : Array<String>
|
|
||||||
if (!equals(s, t)) return "Fail string"
|
if (!equals(s, t)) return "Fail string"
|
||||||
if (s identityEquals t) return "Fail string identity"
|
if (s identityEquals t) return "Fail string identity"
|
||||||
|
|
||||||
val ss = arrayOf(s, s)
|
val ss = arrayOf(s, s)
|
||||||
val tt = ss.clone()
|
val tt: Array<Array<String>> = ss.clone()
|
||||||
tt : Array<Array<String>>
|
|
||||||
if (!equals(ss, tt)) return "Fail string[]"
|
if (!equals(ss, tt)) return "Fail string[]"
|
||||||
if (ss identityEquals tt) return "Fail string[] identity"
|
if (ss identityEquals tt) return "Fail string[] identity"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -18,11 +18,11 @@ fun box() : String {
|
|||||||
b[0] = 1
|
b[0] = 1
|
||||||
assertEquals(1, b[0])
|
assertEquals(1, b[0])
|
||||||
|
|
||||||
val x = 1 : Int?
|
val x: Int? = 1
|
||||||
assertEquals(1, x!!.hashCode())
|
assertEquals(1, x!!.hashCode())
|
||||||
|
|
||||||
val y = 1000 : Int?
|
val y: Int? = 1000
|
||||||
val z = 1000 : Int?
|
val z: Int? = 1000
|
||||||
val res = y.identityEquals(z)
|
val res = y.identityEquals(z)
|
||||||
|
|
||||||
val c1: Any = if (1 == 1) 0 else "abc"
|
val c1: Any = if (1 == 1) 0 else "abc"
|
||||||
|
|||||||
+3
-3
@@ -13,11 +13,11 @@ fun foo() {
|
|||||||
val b = arrayOfNulls<Int>(4)
|
val b = arrayOfNulls<Int>(4)
|
||||||
b[100] = 5
|
b[100] = 5
|
||||||
|
|
||||||
val x = 6 : Int?
|
val x: Int? = 6
|
||||||
val hc = x!!.hashCode()
|
val hc = x!!.hashCode()
|
||||||
|
|
||||||
val y = 7 : Int?
|
val y: Int? = 7
|
||||||
val z = 8 : Int?
|
val z: Int? = 8
|
||||||
val res = y.identityEquals(z)
|
val res = y.identityEquals(z)
|
||||||
|
|
||||||
val c1: Any = if (1 == 1) 0 else "abc"
|
val c1: Any = if (1 == 1) 0 else "abc"
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ fun main(args: Array<String>) {
|
|||||||
var i = 10
|
var i = 10
|
||||||
++i
|
++i
|
||||||
++(l@ i)
|
++(l@ i)
|
||||||
++(i: Int)
|
|
||||||
++(l@ (i: Int))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4 IINC
|
// 2 IINC
|
||||||
+1
-1
@@ -4,6 +4,6 @@ fun foo(s: String): String? {
|
|||||||
return "no message";
|
return "no message";
|
||||||
}
|
}
|
||||||
catch(e: NumberFormatException) {
|
catch(e: NumberFormatException) {
|
||||||
return (e : Throwable).getMessage(); // Work around an overload-resolution bug
|
return e.getMessage(); // Work around an overload-resolution bug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ fun foo(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>varargs<!> <!UNUSED_PARAMETER!>f<!>
|
|||||||
var bar : Int = 1
|
var bar : Int = 1
|
||||||
set(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>varargs<!> v) {}
|
set(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>varargs<!> v) {}
|
||||||
|
|
||||||
val x : (Int) -> Int = {<!UNRESOLVED_REFERENCE!>@varargs<!> <!TYPE_MISMATCH!>x<!> <!DEPRECATED_STATIC_ASSERT!>: Int<!> <!SYNTAX!>-> x<!>}
|
val x : (Int) -> Int = {<!UNRESOLVED_REFERENCE!>@varargs<!> <!TYPE_MISMATCH!>x<!> <!SYNTAX!>: Int -> x<!>}
|
||||||
|
|
||||||
class Hello(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>varargs<!> <!UNUSED_PARAMETER!>args<!>: Any) {
|
class Hello(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>varargs<!> <!UNUSED_PARAMETER!>args<!>: Any) {
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ fun foo(@test <!UNUSED_PARAMETER!>f<!> : Int) {}
|
|||||||
var bar : Int = 1
|
var bar : Int = 1
|
||||||
set(@test v) {}
|
set(@test v) {}
|
||||||
|
|
||||||
val x : (Int) -> Int = {@test <!TYPE_MISMATCH!>x<!> <!DEPRECATED_STATIC_ASSERT!>: Int<!> <!SYNTAX!>-> x<!>} // todo fix parser annotation on lambda parameter
|
val x : (Int) -> Int = {@test <!TYPE_MISMATCH!>x<!> <!SYNTAX!>: Int -> x<!>} // todo fix parser annotation on lambda parameter
|
||||||
|
|
||||||
class Hello(@test <!UNUSED_PARAMETER!>args<!>: Any) {
|
class Hello(@test <!UNUSED_PARAMETER!>args<!>: Any) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package t
|
|
||||||
|
|
||||||
fun foo(array: Array<Int>) {
|
|
||||||
(array[0] : Int) = 22
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package
|
|
||||||
|
|
||||||
package t {
|
|
||||||
public fun foo(/*0*/ array: kotlin.Array<kotlin.Int>): kotlin.Unit
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
val receiver = { Int.(<!SYNTAX!><!>) <!SYNTAX!>-><!> }
|
val receiver = { Int.(<!SYNTAX!><!>) <!SYNTAX!>-><!> }
|
||||||
val receiverWithParameter = { Int.<!ILLEGAL_SELECTOR!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>)<!> <!SYNTAX!>-><!> }
|
val receiverWithParameter = { Int.<!ILLEGAL_SELECTOR!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>)<!> <!SYNTAX!>-><!> }
|
||||||
|
|
||||||
val receiverAndReturnType = { Int.(<!SYNTAX!><!>): Int <!SYNTAX!>-> 5<!> }
|
val receiverAndReturnType = { Int.(<!SYNTAX!><!>)<!SYNTAX!>: Int -> 5<!> }
|
||||||
val receiverAndReturnTypeWithParameter = { Int.<!ILLEGAL_SELECTOR!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>: <!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!>)<!>: Int <!SYNTAX!>-> 5<!> }
|
val receiverAndReturnTypeWithParameter = { Int.(<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!><!SYNTAX!><!SYNTAX!><!>: Int): Int -> 5<!> }
|
||||||
|
|
||||||
val returnType = { (<!SYNTAX!><!>): Int <!SYNTAX!>-> 5<!> }
|
val returnType = { (<!SYNTAX!><!>)<!SYNTAX!>: Int -> 5<!> }
|
||||||
val returnTypeWithParameter = { (<!UNRESOLVED_REFERENCE!>b<!>: Int)<!DEPRECATED_STATIC_ASSERT!>: Int<!> <!SYNTAX!>-> 5<!> }
|
val returnTypeWithParameter = { (<!UNRESOLVED_REFERENCE!>b<!><!SYNTAX!><!SYNTAX!><!>: Int): Int -> 5<!> }
|
||||||
|
|
||||||
val receiverWithFunctionType = { ((Int)<!SYNTAX!><!> <!SYNTAX!>-> Int).() -><!> }
|
val receiverWithFunctionType = { ((Int)<!SYNTAX!><!> <!SYNTAX!>-> Int).() -><!> }
|
||||||
|
|
||||||
val parenthesizedParameters = { (<!UNRESOLVED_REFERENCE!>a<!>: Int) <!SYNTAX!>-><!> }
|
val parenthesizedParameters = { (<!UNRESOLVED_REFERENCE!>a<!><!SYNTAX!><!SYNTAX!><!>: Int) -><!> }
|
||||||
val parenthesizedParameters2 = { (<!UNRESOLVED_REFERENCE!>b<!>) <!SYNTAX!>-><!> }
|
val parenthesizedParameters2 = { (<!UNRESOLVED_REFERENCE!>b<!>) <!SYNTAX!>-><!> }
|
||||||
|
|
||||||
val none = { -> }
|
val none = { -> }
|
||||||
|
|
||||||
|
|
||||||
val parameterWithFunctionType = { <!UNRESOLVED_REFERENCE!>a<!>: ((Int) -> Int) -> <!SYNTAX!><!>} // todo fix parser
|
val parameterWithFunctionType = { <!UNRESOLVED_REFERENCE!>a<!><!SYNTAX!>: ((Int) -> Int) -><!> } // todo fix parser
|
||||||
|
|
||||||
val newSyntax = { a: Int -> }
|
val newSyntax = { a: Int -> }
|
||||||
val newSyntax1 = { <!CANNOT_INFER_PARAMETER_TYPE!>a<!>, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> -> }
|
val newSyntax1 = { <!CANNOT_INFER_PARAMETER_TYPE!>a<!>, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> -> }
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ public val newSyntax2: (kotlin.Int, kotlin.Int) -> kotlin.Unit
|
|||||||
public val newSyntax3: (???, kotlin.Int) -> kotlin.Unit
|
public val newSyntax3: (???, kotlin.Int) -> kotlin.Unit
|
||||||
public val newSyntax4: (kotlin.Int, ???) -> kotlin.Unit
|
public val newSyntax4: (kotlin.Int, ???) -> kotlin.Unit
|
||||||
public val none: () -> kotlin.Unit
|
public val none: () -> kotlin.Unit
|
||||||
public val parameterWithFunctionType: () -> ((kotlin.Int) -> kotlin.Int) -> [ERROR : No type element]
|
public val parameterWithFunctionType: () -> ???
|
||||||
public val parenthesizedParameters: () -> kotlin.Int
|
public val parenthesizedParameters: () -> ???
|
||||||
public val parenthesizedParameters2: () -> ???
|
public val parenthesizedParameters2: () -> ???
|
||||||
public val receiver: () -> ???
|
public val receiver: () -> ???
|
||||||
public val receiverAndReturnType: () -> kotlin.Int
|
public val receiverAndReturnType: () -> ???
|
||||||
public val receiverAndReturnTypeWithParameter: () -> kotlin.Int
|
public val receiverAndReturnTypeWithParameter: () -> ???
|
||||||
public val receiverWithFunctionType: () -> kotlin.Int.Companion
|
public val receiverWithFunctionType: () -> kotlin.Int.Companion
|
||||||
public val receiverWithParameter: () -> ???
|
public val receiverWithParameter: () -> ???
|
||||||
public val returnType: () -> kotlin.Int
|
public val returnType: () -> ???
|
||||||
public val returnTypeWithParameter: () -> kotlin.Int
|
public val returnTypeWithParameter: () -> ???
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
@Suppress("warnings")
|
@Suppress("warnings")
|
||||||
("": String??)
|
("" as String??)
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,6 @@ fun test() {
|
|||||||
|
|
||||||
?.length
|
?.length
|
||||||
|
|
||||||
str
|
|
||||||
|
|
||||||
: String
|
|
||||||
|
|
||||||
str
|
str
|
||||||
|
|
||||||
as String
|
as String
|
||||||
|
|||||||
@@ -41,18 +41,6 @@ JetFile: NewLinesValidOperations.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('length')
|
PsiElement(IDENTIFIER)('length')
|
||||||
PsiWhiteSpace('\n\n ')
|
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
|
BINARY_WITH_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('str')
|
PsiElement(IDENTIFIER)('str')
|
||||||
|
|||||||
Vendored
-10
@@ -26,15 +26,12 @@ fun foo() {
|
|||||||
1 foo 2 ?: 1 bar 3
|
1 foo 2 ?: 1 bar 3
|
||||||
a b c d e f g
|
a b c d e f g
|
||||||
a ?: b in b?: c
|
a ?: b in b?: c
|
||||||
(a : b) < b : c
|
|
||||||
a < b == b > c
|
a < b == b > c
|
||||||
a != b && c
|
a != b && c
|
||||||
a || b && c
|
a || b && c
|
||||||
a = b -> c
|
a = b -> c
|
||||||
a = b || c
|
a = b || c
|
||||||
|
|
||||||
t : Any
|
|
||||||
t : Any?
|
|
||||||
t as Any<T>?
|
t as Any<T>?
|
||||||
t as Any.Any<T>.Any<T>
|
t as Any.Any<T>.Any<T>
|
||||||
t as () -> T
|
t as () -> T
|
||||||
@@ -42,17 +39,10 @@ fun foo() {
|
|||||||
t as? Any.Any<T>.Any<T>
|
t as? Any.Any<T>.Any<T>
|
||||||
t as? () -> T
|
t as? () -> T
|
||||||
|
|
||||||
t : Any * 1
|
|
||||||
t : Any? * 1
|
|
||||||
t as Any<T>? * 1
|
t as Any<T>? * 1
|
||||||
t as Any.Any<T>.Any<T> * 1
|
t as Any.Any<T>.Any<T> * 1
|
||||||
t as () -> T * 1
|
t as () -> T * 1
|
||||||
t as? Any<T>? * 1
|
t as? Any<T>? * 1
|
||||||
t as? Any.Any<T>.Any<T> * 1
|
t as? Any.Any<T>.Any<T> * 1
|
||||||
t as? () -> T * 1
|
t as? () -> T * 1
|
||||||
|
|
||||||
++t : Any + 1
|
|
||||||
a.b : Any + 1
|
|
||||||
|
|
||||||
(t : Any) * 1
|
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-165
@@ -576,37 +576,6 @@ JetFile: Precedence.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('c')
|
PsiElement(IDENTIFIER)('c')
|
||||||
PsiWhiteSpace('\n ')
|
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
|
||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -697,32 +666,6 @@ JetFile: Precedence.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('c')
|
PsiElement(IDENTIFIER)('c')
|
||||||
PsiWhiteSpace('\n\n ')
|
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
|
BINARY_WITH_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('t')
|
PsiElement(IDENTIFIER)('t')
|
||||||
@@ -879,46 +822,6 @@ JetFile: Precedence.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('T')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiWhiteSpace('\n\n ')
|
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_EXPRESSION
|
||||||
BINARY_WITH_TYPE
|
BINARY_WITH_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -1116,72 +1019,5 @@ JetFile: Precedence.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
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')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
Vendored
-1
@@ -44,7 +44,6 @@ val foo.bar = 5
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
val foo = 5
|
val foo = 5
|
||||||
get() = 5
|
get() = 5
|
||||||
set(int : x) = 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val IList<T>.lastIndex : Int
|
val IList<T>.lastIndex : Int
|
||||||
|
|||||||
Vendored
-26
@@ -338,32 +338,6 @@ JetFile: Properties.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('5')
|
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')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n')
|
PsiWhiteSpace('\n\n')
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ class A2 @Ann2("")(x: Int) : B {
|
|||||||
|
|
||||||
class A3 @[Ann3] private @(x: Int)
|
class A3 @[Ann3] private @(x: Int)
|
||||||
class A4 @[Ann4] @private @(x: Int)
|
class A4 @[Ann4] @private @(x: Int)
|
||||||
class A5 private @Ann4(x: Int) : B
|
|
||||||
class A6 @[Ann5] @private @ @[Ann6]()
|
class A6 @[Ann5] @private @ @[Ann6]()
|
||||||
|
|||||||
@@ -150,48 +150,6 @@ JetFile: primaryConstructor.kt
|
|||||||
PsiElement(IDENTIFIER)('Int')
|
PsiElement(IDENTIFIER)('Int')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n')
|
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
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
DELEGATION_SPECIFIER_LIST
|
|
||||||
DELEGATOR_SUPER_CLASS
|
|
||||||
TYPE_REFERENCE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('B')
|
|
||||||
PsiWhiteSpace('\n')
|
|
||||||
CLASS
|
CLASS
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
x as? X ?: return
|
x as? X ?: return
|
||||||
x as? X? : return
|
|
||||||
x as X? ?: return
|
x as X? ?: return
|
||||||
|
|
||||||
X?::x
|
X?::x
|
||||||
|
|||||||
@@ -33,28 +33,6 @@ JetFile: nullableTypes.kt
|
|||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiWhiteSpace('\n ')
|
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_EXPRESSION
|
||||||
BINARY_WITH_TYPE
|
BINARY_WITH_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
|
|||||||
+22
-22
@@ -17,40 +17,40 @@ class Inv<T>() {
|
|||||||
|
|
||||||
fun testInOut() {
|
fun testInOut() {
|
||||||
In<String>().`In.f:T->Unit`f("1");
|
In<String>().`In.f:T->Unit`f("1");
|
||||||
(return : In<in String>).`In.f:T->Unit`f("1");
|
(return as In<in String>).`In.f:T->Unit`f("1");
|
||||||
(return : In<out String>).`In.f:Int->Int`f("1")
|
(return as In<out String>).`In.f:Int->Int`f("1")
|
||||||
(return : In<*>).`In.f:Int->Int`f("1");
|
(return as In<*>).`In.f:Int->Int`f("1");
|
||||||
|
|
||||||
In<String>().`In.f:Int->Int`f(1);
|
In<String>().`In.f:Int->Int`f(1);
|
||||||
(return : In<in String>).`In.f:Int->Int`f(1);
|
(return as In<in String>).`In.f:Int->Int`f(1);
|
||||||
(return : In<out String>).`In.f:Int->Int`f(1)
|
(return as In<out String>).`In.f:Int->Int`f(1)
|
||||||
(return : In<out String>).`!`f1(1)
|
(return as In<out String>).`!`f1(1)
|
||||||
(return : In<*>).`In.f:Int->Int`f(1);
|
(return as In<*>).`In.f:Int->Int`f(1);
|
||||||
|
|
||||||
Out<Int>().`Out.f(a)`f(1)
|
Out<Int>().`Out.f(a)`f(1)
|
||||||
(return : Out<out Int>).`Out.f(a)`f(1)
|
(return as Out<out Int>).`Out.f(a)`f(1)
|
||||||
(return : Out<in Int>).`Out.f(a)`f(1)
|
(return as Out<in Int>).`Out.f(a)`f(1)
|
||||||
(return : Out<*>).`Out.f(a)`f(1)
|
(return as Out<*>).`Out.f(a)`f(1)
|
||||||
|
|
||||||
Out<Int>().`Out.f`f()
|
Out<Int>().`Out.f`f()
|
||||||
(return : Out<out Int>).`Out.f`f()
|
(return as Out<out Int>).`Out.f`f()
|
||||||
(return : Out<in Int>).`Out.f`f()
|
(return as Out<in Int>).`Out.f`f()
|
||||||
(return : Out<*>).`Out.f`f()
|
(return as Out<*>).`Out.f`f()
|
||||||
|
|
||||||
Inv<Int>().`Inv.f`f(1)
|
Inv<Int>().`Inv.f`f(1)
|
||||||
(return : Inv<in Int>).`Inv.f`f(1)
|
(return as Inv<in Int>).`Inv.f`f(1)
|
||||||
(return : Inv<out Int>).`!`f(1)
|
(return as Inv<out Int>).`!`f(1)
|
||||||
(return : Inv<*>).`!`f(1)
|
(return as Inv<*>).`!`f(1)
|
||||||
|
|
||||||
Inv<Int>().`Inv.inf`inf(1)
|
Inv<Int>().`Inv.inf`inf(1)
|
||||||
(return : Inv<in Int>).`Inv.inf`inf(1)
|
(return as Inv<in Int>).`Inv.inf`inf(1)
|
||||||
(return : Inv<out Int>).`!`inf(1)
|
(return as Inv<out Int>).`!`inf(1)
|
||||||
(return : Inv<*>).`!`inf(1)
|
(return as Inv<*>).`!`inf(1)
|
||||||
|
|
||||||
Inv<Int>().`Inv.outf`outf()
|
Inv<Int>().`Inv.outf`outf()
|
||||||
((return : Inv<in Int>).`Inv.outf`outf())`:kotlin::Any`
|
((return as Inv<in Int>).`Inv.outf`outf())`:kotlin::Any`
|
||||||
(return : Inv<out Int>).`Inv.outf`outf()
|
(return as Inv<out Int>).`Inv.outf`outf()
|
||||||
(return : Inv<*>).`Inv.outf`outf()
|
(return as Inv<*>).`Inv.outf`outf()
|
||||||
|
|
||||||
Inv<Int>().`Inv.outf`outf(1)
|
Inv<Int>().`Inv.outf`outf(1)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -8,8 +8,8 @@ import java.`java::java.util`util.*
|
|||||||
fun <T> t(t : T) : T {
|
fun <T> t(t : T) : T {
|
||||||
`c`c(java.lang.Integer(1))
|
`c`c(java.lang.Integer(1))
|
||||||
System.out.`java::java.io.PrintStream.print(Object)`print(t)
|
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(char[])`print(null as CharArray?)
|
||||||
System.out.`java::java.io.PrintStream.print(Object)`print(null : Object?)
|
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(Int)`print(1)
|
||||||
System.out.`java::java.io.PrintStream.print(Double)`print(1.0)
|
System.out.`java::java.io.PrintStream.print(Double)`print(1.0)
|
||||||
}
|
}
|
||||||
|
|||||||
-13
@@ -22,16 +22,3 @@ annotation class Primitives(
|
|||||||
boolean = true
|
boolean = true
|
||||||
)
|
)
|
||||||
class C
|
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
|
|
||||||
|
|
||||||
|
|||||||
-4
@@ -4,10 +4,6 @@ package test
|
|||||||
public constructor C()
|
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 {
|
@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 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
|
public final val boolean: kotlin.Boolean
|
||||||
|
|||||||
@@ -4578,12 +4578,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("checkDeparenthesizedType.kt")
|
||||||
public void testCheckDeparenthesizedType() throws Exception {
|
public void testCheckDeparenthesizedType() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt");
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
|||||||
assertType("Props<out Int>().p", "Int");
|
assertType("Props<out Int>().p", "Int");
|
||||||
assertType("Props<Properties>().p.p", "Int");
|
assertType("Props<Properties>().p.p", "Int");
|
||||||
|
|
||||||
assertType("(return : Props<in Int>).p", "Any?");
|
assertType("(return as Props<in Int>).p", "Any?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOverloads() throws Exception {
|
public void testOverloads() throws Exception {
|
||||||
@@ -444,18 +444,18 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
|||||||
assertType("'1'.minus(1)", "Char");
|
assertType("'1'.minus(1)", "Char");
|
||||||
assertType("'1'.minus('1')", "Int");
|
assertType("'1'.minus('1')", "Int");
|
||||||
|
|
||||||
assertType("(1:Short).plus(1.toDouble())", "Double");
|
assertType("(1.toShort()).plus(1.toDouble())", "Double");
|
||||||
assertType("(1:Short).plus(1.toFloat())", "Float");
|
assertType("(1.toShort()).plus(1.toFloat())", "Float");
|
||||||
assertType("(1:Short).plus(1.toLong())", "Long");
|
assertType("(1.toShort()).plus(1.toLong())", "Long");
|
||||||
assertType("(1:Short).plus(1)", "Int");
|
assertType("(1.toShort()).plus(1)", "Int");
|
||||||
assertType("(1:Short).plus(1:Short)", "Int");
|
assertType("(1.toShort()).plus(1.toShort())", "Int");
|
||||||
|
|
||||||
assertType("(1:Byte).plus(1.toDouble())", "Double");
|
assertType("(1.toByte()).plus(1.toDouble())", "Double");
|
||||||
assertType("(1:Byte).plus(1.toFloat())", "Float");
|
assertType("(1.toByte()).plus(1.toFloat())", "Float");
|
||||||
assertType("(1:Byte).plus(1.toLong())", "Long");
|
assertType("(1.toByte()).plus(1.toLong())", "Long");
|
||||||
assertType("(1:Byte).plus(1)", "Int");
|
assertType("(1.toByte()).plus(1)", "Int");
|
||||||
assertType("(1:Byte).plus(1:Short)", "Int");
|
assertType("(1.toByte()).plus(1.toShort())", "Int");
|
||||||
assertType("(1:Byte).plus(1:Byte)", "Int");
|
assertType("(1.toByte()).plus(1.toByte())", "Int");
|
||||||
|
|
||||||
assertType("\"1\".plus(1.toDouble())", "String");
|
assertType("\"1\".plus(1.toDouble())", "String");
|
||||||
assertType("\"1\".plus(1.toFloat())", "String");
|
assertType("\"1\".plus(1.toFloat())", "String");
|
||||||
|
|||||||
+1
-1
@@ -253,7 +253,7 @@ public abstract class LazyJavaScope(
|
|||||||
c.components.externalSignatureResolver.reportSignatureErrors(propertyDescriptor, signatureErrors)
|
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())) {
|
if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.getType())) {
|
||||||
propertyDescriptor.setCompileTimeInitializer(
|
propertyDescriptor.setCompileTimeInitializer(
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user