Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -377,6 +377,9 @@ public interface Errors {
|
||||
}
|
||||
};
|
||||
|
||||
FunctionSignatureDiagnosticFactory CONFLICTING_OVERLOADS = new FunctionSignatureDiagnosticFactory(ERROR, "{1} is already defined in ''{0}''");
|
||||
|
||||
|
||||
ParameterizedDiagnosticFactory3<String, JetType, JetType> RESULT_TYPE_MISMATCH = ParameterizedDiagnosticFactory3.create(ERROR, "{0} must return {1} but returns {2}");
|
||||
ParameterizedDiagnosticFactory3<String, String, String> UNSAFE_INFIX_CALL = ParameterizedDiagnosticFactory3.create(ERROR, "Infix call corresponds to a dot-qualified call ''{0}.{1}({2})'' which is not allowed on a nullable receiver ''{0}''. Use '?.'-qualified call instead");
|
||||
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package org.jetbrains.jet.lang.diagnostics;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class FunctionSignatureDiagnosticFactory extends DiagnosticFactoryWithMessageFormat {
|
||||
|
||||
public FunctionSignatureDiagnosticFactory(Severity severity, String messageTemplate) {
|
||||
super(severity, messageTemplate);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Diagnostic on(@NotNull JetNamedFunction functionElement, @NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull String functionContainer)
|
||||
{
|
||||
TextRange rangeToMark = new TextRange(
|
||||
functionElement.getStartOfSignatureElement().getTextRange().getStartOffset(),
|
||||
functionElement.getEndOfSignatureElement().getTextRange().getEndOffset()
|
||||
);
|
||||
String message = messageFormat.format(new Object[]{
|
||||
functionContainer,
|
||||
DescriptorRenderer.TEXT.render(functionDescriptor)});
|
||||
return new GenericDiagnostic(this, severity, message, functionElement.getContainingFile(), rangeToMark);
|
||||
}
|
||||
|
||||
} //~
|
||||
@@ -19,7 +19,12 @@ public abstract class JetNamedDeclaration extends JetDeclaration implements PsiN
|
||||
@Override
|
||||
public String getName() {
|
||||
PsiElement identifier = getNameIdentifier();
|
||||
return identifier != null ? identifier.getText() : null;
|
||||
if (identifier != null) {
|
||||
String text = identifier.getText();
|
||||
return text != null ? JetPsiUtil.unquoteIdentifier(text) : null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,4 +40,26 @@ public class JetNamedFunction extends JetFunction {
|
||||
return findChildByType(JetTokens.EQ) == null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetElement getStartOfSignatureElement() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetElement getEndOfSignatureElement() {
|
||||
JetElement r = getReturnTypeRef();
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
|
||||
r = getValueParameterList();
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
|
||||
// otherwise it is an error
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,4 +73,30 @@ public class JetPsiUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String unquoteIdentifier(@NotNull String quoted) {
|
||||
if (quoted.indexOf('`') < 0) {
|
||||
return quoted;
|
||||
}
|
||||
|
||||
if (quoted.startsWith("`") && quoted.endsWith("`") && quoted.length() >= 2) {
|
||||
return quoted.substring(1, quoted.length() - 1);
|
||||
} else {
|
||||
return quoted;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String unquoteIdentifierOrFieldReference(@NotNull String quoted) {
|
||||
if (quoted.indexOf('`') < 0) {
|
||||
return quoted;
|
||||
}
|
||||
|
||||
if (quoted.startsWith("$")) {
|
||||
return "$" + unquoteIdentifier(quoted.substring(1));
|
||||
} else {
|
||||
return unquoteIdentifier(quoted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
return null;
|
||||
}
|
||||
String text = referencedNameElement.getNode().getText();
|
||||
if (text.startsWith("`") && text.endsWith("`") && text.length() >= 2) {
|
||||
return text.substring(1, text.length()-1);
|
||||
}
|
||||
return text;
|
||||
return text != null ? JetPsiUtil.unquoteIdentifierOrFieldReference(text) : null;
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface BindingContext {
|
||||
if (declarationPsiElement instanceof JetParameter) {
|
||||
JetParameter jetParameter = (JetParameter) declarationPsiElement;
|
||||
return jetParameter.getValOrVarNode() != null ||
|
||||
backingFieldRequired;
|
||||
backingFieldRequired; // this part is unused because we do not allow access to constructor parameters in member bodies
|
||||
}
|
||||
if (propertyDescriptor.getModality() == Modality.ABSTRACT) return false;
|
||||
PropertyGetterDescriptor getter = propertyDescriptor.getGetter();
|
||||
|
||||
@@ -57,6 +57,7 @@ public class BodyResolver {
|
||||
});
|
||||
|
||||
// This tracks access to properties in order to register primary constructor parameters that yield real fields (JET-9)
|
||||
// NOTE!!! This code is not used, because we do not allow constructor parameter access in member bodies
|
||||
this.traceForMembers = new ObservableBindingTrace(context.getTrace()).addHandler(BindingContext.REFERENCE_TARGET, new ObservableBindingTrace.RecordHandler<JetReferenceExpression, DeclarationDescriptor>() {
|
||||
@Override
|
||||
public void handleRecord(WritableSlice<JetReferenceExpression, DeclarationDescriptor> slice, JetReferenceExpression expression, DeclarationDescriptor descriptor) {
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.DELEGATED;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class OverloadResolver {
|
||||
private final TopDownAnalysisContext context;
|
||||
|
||||
public OverloadResolver(@NotNull TopDownAnalysisContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void process() {
|
||||
checkOverloads();
|
||||
}
|
||||
|
||||
private void checkOverloads() {
|
||||
for (Map.Entry<JetClass, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
||||
checkOverloadsInAClass(entry.getValue(), entry.getKey());
|
||||
}
|
||||
for (Map.Entry<JetObjectDeclaration, MutableClassDescriptor> entry : context.getObjects().entrySet()) {
|
||||
checkOverloadsInAClass(entry.getValue(), entry.getKey());
|
||||
}
|
||||
checkOverloadsInANamespace();
|
||||
}
|
||||
|
||||
private void checkOverloadsInANamespace() {
|
||||
class Key extends Pair<String, String> {
|
||||
Key(String namespace, String name) {
|
||||
super(namespace, name);
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return first;
|
||||
}
|
||||
|
||||
public String getFunctionName() {
|
||||
return second;
|
||||
}
|
||||
}
|
||||
|
||||
MultiMap<Key, FunctionDescriptor> functionsByName = MultiMap.create();
|
||||
|
||||
for (FunctionDescriptorImpl function : context.getFunctions().values()) {
|
||||
DeclarationDescriptor containingDeclaration = function.getContainingDeclaration();
|
||||
if (containingDeclaration instanceof NamespaceDescriptor) {
|
||||
NamespaceDescriptor namespaceDescriptor = (NamespaceDescriptor) containingDeclaration;
|
||||
functionsByName.putValue(new Key(namespaceDescriptor.getName(), function.getName()), function);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<Key, Collection<FunctionDescriptor>> e : functionsByName.entrySet()) {
|
||||
checkOverloadsWithSameName(e.getKey().getFunctionName(), e.getValue(), e.getKey().getNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOverloadsInAClass(MutableClassDescriptor classDescriptor, JetClassOrObject klass) {
|
||||
MultiMap<String, FunctionDescriptor> functionsByName = MultiMap.create();
|
||||
|
||||
for (FunctionDescriptor function : classDescriptor.getFunctions()) {
|
||||
functionsByName.putValue(function.getName(), function);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Collection<FunctionDescriptor>> e : functionsByName.entrySet()) {
|
||||
checkOverloadsWithSameName(e.getKey(), e.getValue(), klass.getName());
|
||||
}
|
||||
|
||||
// properties are checked elsewhere
|
||||
|
||||
// Kotlin has no secondary constructors at this time
|
||||
|
||||
}
|
||||
|
||||
private void checkOverloadsWithSameName(String name, Collection<FunctionDescriptor> functions, String functionContainer) {
|
||||
if (functions.size() == 1) {
|
||||
// microoptimization
|
||||
return;
|
||||
}
|
||||
|
||||
for (FunctionDescriptor function : functions) {
|
||||
for (FunctionDescriptor function2 : functions) {
|
||||
if (function == function2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
OverloadUtil.OverloadCompatibilityInfo overloadble = OverloadUtil.isOverloadble(function, function2);
|
||||
if (!overloadble.isSuccess()) {
|
||||
JetNamedFunction member = (JetNamedFunction) context.getTrace().get(BindingContext.DESCRIPTOR_TO_DECLARATION, function);
|
||||
if (member == null) {
|
||||
assert context.getTrace().get(DELEGATED, function);
|
||||
return;
|
||||
}
|
||||
|
||||
context.getTrace().report(Errors.CONFLICTING_OVERLOADS.on(member, function, functionContainer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class OverloadUtil {
|
||||
|
||||
public static OverloadCompatibilityInfo isOverloadble(FunctionDescriptor a, FunctionDescriptor b) {
|
||||
OverridingUtil.OverrideCompatibilityInfo overrideCompatibilityInfo = OverridingUtil.isOverridableByImpl(a, b, false);
|
||||
if (overrideCompatibilityInfo.isSuccess()) {
|
||||
return OverloadCompatibilityInfo.someError();
|
||||
} else {
|
||||
return OverloadCompatibilityInfo.success();
|
||||
}
|
||||
}
|
||||
|
||||
public static class OverloadCompatibilityInfo {
|
||||
|
||||
private static final OverloadCompatibilityInfo SUCCESS = new OverloadCompatibilityInfo(true, "SUCCESS");
|
||||
|
||||
public static OverloadCompatibilityInfo success() {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public static OverloadCompatibilityInfo someError() {
|
||||
return new OverloadCompatibilityInfo(false, "XXX");
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private final boolean isSuccess;
|
||||
private final String message;
|
||||
|
||||
public OverloadCompatibilityInfo(boolean success, String message) {
|
||||
isSuccess = success;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -97,6 +97,8 @@ public class OverrideResolver {
|
||||
}
|
||||
|
||||
protected void checkOverridesInAClass(MutableClassDescriptor classDescriptor, JetClassOrObject klass) {
|
||||
if (context.analyzingBootstrapLibrary()) return;
|
||||
|
||||
// Check overrides for internal consistency
|
||||
for (CallableMemberDescriptor member : classDescriptor.getCallableMembers()) {
|
||||
checkOverride(member);
|
||||
|
||||
@@ -93,6 +93,13 @@ public class OverridingUtil {
|
||||
|
||||
@NotNull
|
||||
public static OverrideCompatibilityInfo isOverridableBy(@NotNull CallableDescriptor superDescriptor, @NotNull CallableDescriptor subDescriptor) {
|
||||
return isOverridableByImpl(superDescriptor, subDescriptor, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param forOverride true for override, false for overload
|
||||
*/
|
||||
static OverrideCompatibilityInfo isOverridableByImpl(CallableDescriptor superDescriptor, CallableDescriptor subDescriptor, boolean forOverride) {
|
||||
if (superDescriptor instanceof FunctionDescriptor) {
|
||||
if (subDescriptor instanceof PropertyDescriptor) return OverrideCompatibilityInfo.memberKindMismatch();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ import java.util.Set;
|
||||
|
||||
private StringBuilder debugOutput;
|
||||
|
||||
private boolean analyzingBootstrapLibrary = false;
|
||||
|
||||
public TopDownAnalysisContext(JetSemanticServices semanticServices, BindingTrace trace, Predicate<PsiFile> analyzeCompletely) {
|
||||
this.trace = new ObservableBindingTrace(trace);
|
||||
this.semanticServices = semanticServices;
|
||||
@@ -66,6 +68,14 @@ import java.util.Set;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean analyzingBootstrapLibrary() {
|
||||
return analyzingBootstrapLibrary;
|
||||
}
|
||||
|
||||
public void setAnalyzingBootstrapLibrary(boolean analyzingBootstrapLibrary) {
|
||||
this.analyzingBootstrapLibrary = analyzingBootstrapLibrary;
|
||||
}
|
||||
|
||||
public boolean completeAnalysisNeeded(@NotNull PsiElement element) {
|
||||
PsiFile containingFile = element.getContainingFile();
|
||||
boolean result = containingFile != null && analyzeCompletely.apply(containingFile);
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetNamespace;
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
|
||||
@@ -45,6 +44,16 @@ public class TopDownAnalyzer {
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
boolean declaredLocally) {
|
||||
TopDownAnalysisContext context = new TopDownAnalysisContext(semanticServices, trace, analyzeCompletely);
|
||||
doProcess(context, outerScope, owner, declarations, flowDataTraceFactory, declaredLocally);
|
||||
|
||||
}
|
||||
|
||||
private static void doProcess(
|
||||
TopDownAnalysisContext context, JetScope outerScope,
|
||||
NamespaceLike owner,
|
||||
Collection<? extends JetDeclaration> declarations,
|
||||
JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
boolean declaredLocally) {
|
||||
// context.enableDebugOutput();
|
||||
context.debug("Enter");
|
||||
|
||||
@@ -52,9 +61,12 @@ public class TopDownAnalyzer {
|
||||
new DeclarationResolver(context).process();
|
||||
new DelegationResolver(context).process();
|
||||
new OverrideResolver(context).process();
|
||||
new BodyResolver(context).resolveBehaviorDeclarationBodies();
|
||||
new ControlFlowAnalyzer(context, flowDataTraceFactory, declaredLocally).process();
|
||||
new DeclarationsChecker(context).process();
|
||||
new OverloadResolver(context).process();
|
||||
if (!context.analyzingBootstrapLibrary()) {
|
||||
new BodyResolver(context).resolveBehaviorDeclarationBodies();
|
||||
new ControlFlowAnalyzer(context, flowDataTraceFactory, declaredLocally).process();
|
||||
new DeclarationsChecker(context).process();
|
||||
}
|
||||
|
||||
context.debug("Exit");
|
||||
context.printDebugOutput(System.out);
|
||||
@@ -68,17 +80,9 @@ public class TopDownAnalyzer {
|
||||
context.getNamespaceScopes().put(namespace, standardLibraryNamespace.getMemberScope());
|
||||
context.getNamespaceDescriptors().put(namespace, standardLibraryNamespace);
|
||||
context.getDeclaringScopes().put(namespace, outerScope);
|
||||
context.setAnalyzingBootstrapLibrary(true);
|
||||
|
||||
new TypeHierarchyResolver(context).process(outerScope, standardLibraryNamespace, namespace.getDeclarations());
|
||||
new DeclarationResolver(context).process();
|
||||
new DelegationResolver(context).process();
|
||||
OverrideResolver overrideResolver = new OverrideResolver(context) {
|
||||
@Override
|
||||
protected void checkOverridesInAClass(MutableClassDescriptor classDescriptor, JetClassOrObject klass) {
|
||||
}
|
||||
};
|
||||
overrideResolver.process();
|
||||
new BodyResolver(context).resolveBehaviorDeclarationBodies();
|
||||
doProcess(context, outerScope, standardLibraryNamespace, namespace.getDeclarations(), JetControlFlowDataTraceFactory.EMPTY, false);
|
||||
}
|
||||
|
||||
public static void processObject(
|
||||
|
||||
@@ -442,7 +442,7 @@ public class CallResolver {
|
||||
}
|
||||
|
||||
ConstraintSystemSolution solution = constraintSystem.solve();
|
||||
if (solution.isSuccessful()) {
|
||||
if (solution.getStatus().isSuccessful()) {
|
||||
D substitute = (D) candidate.substitute(solution.getSubstitutor());
|
||||
assert substitute != null;
|
||||
replaceValueParametersWithSubstitutedOnes(candidateCall, substitute);
|
||||
|
||||
+15
-7
@@ -164,22 +164,30 @@ public class CompileTimeConstantResolver {
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
assert text.charAt(0) == '\'' && text.charAt(text.length() - 1) == '\'';
|
||||
|
||||
if (text.charAt(0) != '\'' || text.charAt(text.length() - 1) != '\'') {
|
||||
return new ErrorValue("Incorret character constant");
|
||||
}
|
||||
|
||||
text = text.substring(1, text.length() - 1);
|
||||
assert text.length() < 3 && text.length() > 0;
|
||||
|
||||
if (text.length() == 2) {
|
||||
assert text.charAt(0) == '\\';
|
||||
if (text.length() == 0) {
|
||||
return new ErrorValue("Empty character literal");
|
||||
} else if (text.length() == 1) {
|
||||
if (text.charAt(0) == '\\') {
|
||||
return new ErrorValue("Illegal escape: " + text);
|
||||
} else {
|
||||
return new CharValue(text.charAt(0));
|
||||
}
|
||||
} else if (text.length() == 2 && text.charAt(0) == '\\') {
|
||||
Character escaped = translateEscape(text.charAt(1));
|
||||
if (escaped == null) {
|
||||
return new ErrorValue("Illegal escape: " + text);
|
||||
}
|
||||
return new CharValue(escaped);
|
||||
} else {
|
||||
return new ErrorValue("Too many characters in character literal");
|
||||
}
|
||||
|
||||
assert text.length() == 1;
|
||||
return new CharValue(text.charAt(0));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+53
-14
@@ -269,8 +269,10 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
|
||||
private void addSubtypingConstraintOnTypeValues(TypeValue typeValueForLower, TypeValue typeValueForUpper) {
|
||||
println(typeValueForLower + " :< " + typeValueForUpper);
|
||||
typeValueForLower.getUpperBounds().add(typeValueForUpper);
|
||||
typeValueForUpper.getLowerBounds().add(typeValueForLower);
|
||||
if (typeValueForLower != typeValueForUpper) {
|
||||
typeValueForLower.getUpperBounds().add(typeValueForUpper);
|
||||
typeValueForUpper.getLowerBounds().add(typeValueForLower);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -286,7 +288,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
KnownType knownBoundType = (KnownType) upperBound;
|
||||
boolean ok = constraintExpander.run(jetType, knownBoundType.getType());
|
||||
if (!ok) {
|
||||
return new Solution(true);
|
||||
return new Solution().registerError("Mismatch while expanding constraints");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,7 +316,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
}
|
||||
|
||||
// Find inconsistencies
|
||||
Solution solution = new Solution(false);
|
||||
Solution solution = new Solution();
|
||||
|
||||
for (UnknownType unknownType : unknownTypes.values()) {
|
||||
check(unknownType, solution);
|
||||
@@ -337,20 +339,33 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
for (TypeValue upperBound : typeValue.getUpperBounds()) {
|
||||
JetType boundingType = solution.getSubstitutor().substitute(upperBound.getValue().getType(), Variance.INVARIANT);
|
||||
if (!typeChecker.isSubtypeOf(type, boundingType)) { // TODO
|
||||
solution.registerError();
|
||||
solution.registerError("Constraint violation: " + type + " is not a subtype of " + boundingType);
|
||||
println("Constraint violation: " + type + " :< " + boundingType);
|
||||
}
|
||||
}
|
||||
for (TypeValue lowerBound : typeValue.getLowerBounds()) {
|
||||
JetType boundingType = solution.getSubstitutor().substitute(lowerBound.getValue().getType(), Variance.INVARIANT);
|
||||
if (!typeChecker.isSubtypeOf(boundingType, type)) {
|
||||
solution.registerError();
|
||||
solution.registerError("Constraint violation: " + boundingType + " is not a subtype of " + type);
|
||||
println("Constraint violation: " + boundingType + " :< " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (LoopInTypeVariableConstraintsException e) {
|
||||
solution.registerError();
|
||||
println("-------------------------------------------------------------------");
|
||||
for (Map.Entry<TypeParameterDescriptor, UnknownType> entry : unknownTypes.entrySet()) {
|
||||
println("Unknown: " + entry.getKey());
|
||||
UnknownType unknownType = entry.getValue();
|
||||
println("Lower bounds: ");
|
||||
for (TypeValue lowerBound : unknownType.getLowerBounds()) {
|
||||
println(" " + lowerBound);
|
||||
}
|
||||
println("Upper bounds: ");
|
||||
for (TypeValue lowerBound : unknownType.getUpperBounds()) {
|
||||
println(" " + lowerBound);
|
||||
}
|
||||
}
|
||||
solution.registerError("[TODO] Loop in constraints");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -369,6 +384,25 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
}
|
||||
}
|
||||
|
||||
private static class Error implements SolutionStatus {
|
||||
|
||||
private final String message;
|
||||
|
||||
private Error(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccessful() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public class Solution implements ConstraintSystemSolution {
|
||||
private final TypeSubstitutor typeSubstitutor = TypeSubstitutor.create(new TypeSubstitutor.TypeSubstitution() {
|
||||
@Override
|
||||
@@ -376,6 +410,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
DeclarationDescriptor declarationDescriptor = key.getDeclarationDescriptor();
|
||||
if (declarationDescriptor instanceof TypeParameterDescriptor) {
|
||||
TypeParameterDescriptor descriptor = (TypeParameterDescriptor) declarationDescriptor;
|
||||
if (!unknownTypes.containsKey(descriptor)) return null;
|
||||
println(descriptor + " |-> " + getValue(descriptor));
|
||||
return new TypeProjection(getValue(descriptor));
|
||||
}
|
||||
@@ -387,19 +422,22 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
private boolean failed;
|
||||
|
||||
public Solution(boolean failed) {
|
||||
this.failed = failed;
|
||||
private SolutionStatus status;
|
||||
|
||||
public Solution() {
|
||||
this.status = SolutionStatus.SUCCESS;
|
||||
}
|
||||
|
||||
private void registerError() {
|
||||
failed = true;
|
||||
private Solution registerError(String message) {
|
||||
status = new Error(message);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public boolean isSuccessful() {
|
||||
return !failed;
|
||||
public SolutionStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -408,6 +446,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
||||
return value == null ? null : value.getType();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TypeSubstitutor getSubstitutor() {
|
||||
return typeSubstitutor;
|
||||
|
||||
+4
-1
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.jet.lang.types.inference;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
@@ -9,8 +10,10 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface ConstraintSystemSolution {
|
||||
boolean isSuccessful();
|
||||
@NotNull
|
||||
SolutionStatus getStatus();
|
||||
|
||||
@NotNull
|
||||
TypeSubstitutor getSubstitutor();
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.jetbrains.jet.lang.types.inference;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface SolutionStatus {
|
||||
SolutionStatus SUCCESS = new SolutionStatus() {
|
||||
@Override
|
||||
public boolean isSuccessful() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
boolean isSuccessful();
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package org.jetbrains.jet.lexer;
|
||||
|
||||
import java.util.*;
|
||||
@@ -59,7 +58,7 @@ IDENTIFIER_PART=[:digit:]|{LETTER}
|
||||
PLAIN_IDENTIFIER={LETTER} {IDENTIFIER_PART}*
|
||||
// TODO: this one MUST allow everything accepted by the runtime
|
||||
// TODO: Replace backticks by one backslash in the begining
|
||||
ESCAPED_IDENTIFIER = `{PLAIN_IDENTIFIER}`
|
||||
ESCAPED_IDENTIFIER = `[^`\n]+`
|
||||
IDENTIFIER = {PLAIN_IDENTIFIER}|{ESCAPED_IDENTIFIER}
|
||||
FIELD_IDENTIFIER = \${IDENTIFIER}
|
||||
LABEL_IDENTIFIER = \@{IDENTIFIER}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 10/19/11 2:50 PM */
|
||||
/* The following code was generated by JFlex 1.4.3 on 11/10/11 3:46 PM */
|
||||
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package org.jetbrains.jet.lexer;
|
||||
|
||||
import java.util.*;
|
||||
@@ -14,8 +13,8 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
|
||||
* on 10/19/11 2:50 PM from the specification file
|
||||
* <tt>/Users/abreslav/work/jet/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex</tt>
|
||||
* on 11/10/11 3:46 PM from the specification file
|
||||
* <tt>/Users/yozh/devel/jb/jet/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex</tt>
|
||||
*/
|
||||
class _JetLexer implements FlexLexer {
|
||||
/** initial size of the lookahead buffer */
|
||||
@@ -41,10 +40,10 @@ class _JetLexer implements FlexLexer {
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED =
|
||||
"\11\0\1\3\1\13\1\0\1\3\23\0\1\3\1\57\1\25\1\77"+
|
||||
"\1\7\1\67\1\65\1\23\1\72\1\73\1\12\1\62\1\76\1\21"+
|
||||
"\1\17\1\11\1\14\11\1\1\74\1\75\1\63\1\60\1\64\1\61"+
|
||||
"\1\10\1\2\1\16\2\2\1\20\1\2\11\4\1\22\3\4\1\54"+
|
||||
"\11\0\1\3\1\7\1\0\1\3\23\0\1\3\1\57\1\25\1\77"+
|
||||
"\1\10\1\67\1\65\1\23\1\72\1\73\1\13\1\62\1\76\1\21"+
|
||||
"\1\17\1\12\1\14\11\1\1\74\1\75\1\63\1\60\1\64\1\61"+
|
||||
"\1\11\1\2\1\16\2\2\1\20\1\2\11\4\1\22\3\4\1\54"+
|
||||
"\3\4\1\15\2\4\1\70\1\24\1\71\1\0\1\4\1\6\1\31"+
|
||||
"\1\44\1\36\1\56\1\33\1\52\1\4\1\47\1\41\1\45\1\51"+
|
||||
"\1\50\1\32\1\30\1\37\1\35\1\4\1\43\1\34\1\40\1\42"+
|
||||
@@ -124,21 +123,21 @@ class _JetLexer implements FlexLexer {
|
||||
"\1\7\1\2\1\10\1\11\1\12\1\13\1\14\1\15"+
|
||||
"\17\3\1\16\1\17\1\20\1\21\1\22\1\23\2\1"+
|
||||
"\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+
|
||||
"\1\34\2\35\1\36\1\0\1\37\1\40\1\0\1\41"+
|
||||
"\1\42\1\0\1\43\1\0\1\44\1\0\1\45\1\0"+
|
||||
"\1\46\1\47\1\50\1\51\1\52\1\43\2\2\1\43"+
|
||||
"\1\53\1\54\1\55\1\56\2\12\1\0\2\3\1\57"+
|
||||
"\10\3\1\60\1\61\1\62\10\3\1\63\1\0\1\64"+
|
||||
"\1\65\1\66\1\67\1\70\1\71\1\72\1\73\1\74"+
|
||||
"\1\75\1\76\1\0\1\77\1\100\1\0\1\101\1\43"+
|
||||
"\1\3\2\0\1\50\1\102\4\0\1\103\2\3\1\104"+
|
||||
"\7\3\1\105\10\3\1\106\1\107\1\3\1\110\1\111"+
|
||||
"\1\112\1\113\1\114\1\115\1\0\1\40\1\44\1\45"+
|
||||
"\1\0\2\102\1\43\2\0\1\3\1\116\1\117\5\3"+
|
||||
"\1\120\1\121\1\3\1\122\2\3\1\123\2\3\1\124"+
|
||||
"\1\125\1\76\1\50\2\0\1\3\1\126\1\3\1\127"+
|
||||
"\1\3\1\130\1\131\1\3\1\132\1\133\1\134\1\103"+
|
||||
"\2\3\1\135\1\136\3\3\1\137\1\140";
|
||||
"\1\34\1\35\1\36\1\35\1\0\1\37\1\40\1\0"+
|
||||
"\1\41\1\42\1\0\1\43\1\0\1\44\1\0\1\45"+
|
||||
"\1\0\1\46\1\47\1\50\1\51\1\52\1\43\2\2"+
|
||||
"\1\43\1\53\1\54\1\55\1\56\2\12\1\0\2\3"+
|
||||
"\1\57\10\3\1\60\1\61\1\62\10\3\1\63\1\0"+
|
||||
"\1\64\1\65\1\66\1\67\1\70\1\71\1\72\1\73"+
|
||||
"\1\74\1\75\1\76\1\0\1\77\1\100\1\0\1\101"+
|
||||
"\1\43\1\3\2\0\1\50\1\102\4\0\1\103\2\3"+
|
||||
"\1\104\7\3\1\105\10\3\1\106\1\107\1\3\1\110"+
|
||||
"\1\111\1\112\1\113\1\114\1\115\1\0\1\40\1\44"+
|
||||
"\1\45\1\0\2\102\1\43\2\0\1\3\1\116\1\117"+
|
||||
"\5\3\1\120\1\121\1\3\1\122\2\3\1\123\2\3"+
|
||||
"\1\124\1\125\1\76\1\50\2\0\1\3\1\126\1\3"+
|
||||
"\1\127\1\3\1\130\1\131\1\3\1\132\1\133\1\134"+
|
||||
"\1\103\2\3\1\135\1\136\3\3\1\137\1\140";
|
||||
|
||||
private static int [] zzUnpackAction() {
|
||||
int [] result = new int[217];
|
||||
@@ -172,7 +171,7 @@ class _JetLexer implements FlexLexer {
|
||||
"\0\u0580\0\u05c0\0\u0600\0\u0640\0\u0680\0\u06c0\0\u0700\0\u0740"+
|
||||
"\0\u0780\0\u07c0\0\u0800\0\u0840\0\u0880\0\u0100\0\u08c0\0\u0900"+
|
||||
"\0\u0940\0\u0980\0\u09c0\0\u0a00\0\u0100\0\u0100\0\u0100\0\u0100"+
|
||||
"\0\u0100\0\u0100\0\u0100\0\u0100\0\u0a40\0\u0a80\0\u0100\0\u0ac0"+
|
||||
"\0\u0100\0\u0100\0\u0100\0\u0100\0\u0a40\0\u0100\0\u0a80\0\u0ac0"+
|
||||
"\0\u0100\0\u0b00\0\u0b40\0\u0100\0\u0100\0\u0b80\0\u0bc0\0\u0c00"+
|
||||
"\0\u0c40\0\u0c80\0\u0cc0\0\u0d00\0\u0100\0\u0d40\0\u0d80\0\u0100"+
|
||||
"\0\u0100\0\u0dc0\0\u0e00\0\u0e40\0\u0e80\0\u0100\0\u0100\0\u0100"+
|
||||
@@ -219,177 +218,166 @@ class _JetLexer implements FlexLexer {
|
||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\1\5\1\6\1\7\1\10\1\7\1\5\1\11\1\12"+
|
||||
"\1\13\1\14\1\15\1\10\1\16\2\7\1\17\1\7"+
|
||||
"\1\5\1\6\1\7\1\10\1\7\1\5\1\11\1\10"+
|
||||
"\1\12\1\13\1\14\1\15\1\16\2\7\1\17\1\7"+
|
||||
"\1\20\1\7\1\21\1\5\1\22\1\23\1\24\1\25"+
|
||||
"\1\26\1\7\1\27\1\30\1\7\1\31\1\32\1\33"+
|
||||
"\1\34\1\7\1\35\1\36\1\7\1\37\3\7\1\40"+
|
||||
"\1\7\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+
|
||||
"\1\50\1\51\1\52\1\53\1\54\1\55\1\56\1\57"+
|
||||
"\1\60\1\61\1\62\1\63\1\64\7\65\1\66\3\65"+
|
||||
"\1\67\10\65\1\70\1\71\52\65\2\0\1\72\1\0"+
|
||||
"\1\72\1\0\1\73\6\0\2\72\1\0\1\72\1\0"+
|
||||
"\1\72\5\0\27\72\21\0\1\5\1\6\1\7\1\10"+
|
||||
"\1\7\1\5\1\11\1\12\1\13\1\14\1\15\1\10"+
|
||||
"\1\16\2\7\1\17\1\7\1\20\1\7\1\21\1\5"+
|
||||
"\1\22\1\74\1\75\1\25\1\26\1\7\1\27\1\30"+
|
||||
"\1\7\1\31\1\32\1\33\1\34\1\7\1\35\1\36"+
|
||||
"\1\7\1\37\3\7\1\40\1\7\1\41\1\42\1\43"+
|
||||
"\1\44\1\45\1\46\1\47\1\50\1\51\1\52\1\53"+
|
||||
"\1\54\1\55\1\56\1\57\1\60\1\61\1\62\1\63"+
|
||||
"\1\64\101\0\1\6\12\0\1\6\2\0\1\76\1\77"+
|
||||
"\12\0\1\77\45\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\27\7\24\0\1\10"+
|
||||
"\7\0\1\10\66\0\1\100\1\0\1\100\10\0\2\100"+
|
||||
"\1\0\1\100\1\0\1\100\5\0\27\100\23\0\1\101"+
|
||||
"\1\0\1\101\1\0\1\102\6\0\2\101\1\0\1\101"+
|
||||
"\1\0\1\101\5\0\27\101\23\0\1\103\1\0\1\103"+
|
||||
"\1\0\1\104\1\0\1\105\4\0\2\103\1\0\1\103"+
|
||||
"\1\0\1\103\5\0\27\103\32\0\1\106\1\107\45\0"+
|
||||
"\1\110\77\0\1\111\20\0\1\112\12\0\1\112\1\113"+
|
||||
"\1\114\1\76\1\77\12\0\1\77\10\0\1\114\34\0"+
|
||||
"\1\115\12\0\1\115\2\0\1\116\101\0\1\117\36\0"+
|
||||
"\1\120\3\0\1\121\13\0\13\21\1\0\7\21\1\122"+
|
||||
"\1\123\53\21\25\0\1\124\53\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\1\7"+
|
||||
"\1\125\10\7\1\126\14\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\4\7"+
|
||||
"\1\127\22\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\20\7\1\130\6\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\12\7\1\131\14\7\22\0\2\7"+
|
||||
"\1\60\1\61\1\62\1\63\1\64\7\65\1\66\1\67"+
|
||||
"\13\65\1\70\1\71\52\65\2\0\1\72\1\0\1\72"+
|
||||
"\1\0\1\73\6\0\2\72\1\0\1\72\1\0\1\72"+
|
||||
"\5\0\27\72\21\0\1\5\1\6\1\7\1\10\1\7"+
|
||||
"\1\5\1\11\1\10\1\12\1\13\1\14\1\15\1\16"+
|
||||
"\2\7\1\17\1\7\1\20\1\7\1\21\1\5\1\22"+
|
||||
"\1\74\1\75\1\25\1\26\1\7\1\27\1\30\1\7"+
|
||||
"\1\31\1\32\1\33\1\34\1\7\1\35\1\36\1\7"+
|
||||
"\1\37\3\7\1\40\1\7\1\41\1\42\1\43\1\44"+
|
||||
"\1\45\1\46\1\47\1\50\1\51\1\52\1\53\1\54"+
|
||||
"\1\55\1\56\1\57\1\60\1\61\1\62\1\63\1\64"+
|
||||
"\101\0\1\6\12\0\1\6\2\0\1\76\1\77\12\0"+
|
||||
"\1\77\45\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\27\7\24\0\1\10\3\0"+
|
||||
"\1\10\70\0\6\100\2\0\70\100\2\0\1\101\1\0"+
|
||||
"\1\101\1\0\1\102\6\0\2\101\1\0\1\101\1\0"+
|
||||
"\1\101\5\0\27\101\23\0\1\103\1\0\1\103\1\0"+
|
||||
"\1\104\2\0\1\105\3\0\2\103\1\0\1\103\1\0"+
|
||||
"\1\103\5\0\27\103\33\0\1\106\1\107\44\0\1\110"+
|
||||
"\77\0\1\111\20\0\1\112\12\0\1\112\1\113\1\114"+
|
||||
"\1\76\1\77\12\0\1\77\10\0\1\114\34\0\1\115"+
|
||||
"\12\0\1\115\2\0\1\116\101\0\1\117\36\0\1\120"+
|
||||
"\3\0\1\121\13\0\7\21\1\0\13\21\1\122\1\123"+
|
||||
"\53\21\25\0\1\124\53\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\1\7\1\125"+
|
||||
"\10\7\1\126\14\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\4\7\1\127"+
|
||||
"\22\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\20\7\1\130\6\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\12\7\1\131\14\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\7\7\1\132\10\7\1\133\6\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\14\7\1\134\12\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\13\7\1\135"+
|
||||
"\3\7\1\136\3\7\1\137\3\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\1\140\3\7\1\141\15\7\1\142\4\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\7\7\1\132\10\7\1\133\6\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\14\7\1\134\12\7\22\0\2\7\1\0\2\7"+
|
||||
"\5\0\3\7\1\143\23\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\13\7"+
|
||||
"\1\135\3\7\1\136\3\7\1\137\3\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\1\140\3\7\1\141\15\7\1\142\4\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\3\7\1\143\23\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\13\7\1\144\13\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\17\7\1\145"+
|
||||
"\7\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\1\7\1\146\5\7\1\147"+
|
||||
"\2\7\1\150\14\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\17\7\1\151"+
|
||||
"\7\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\1\7\1\152\25\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\7\7\1\153\17\7\62\0\1\154\16\0"+
|
||||
"\1\155\77\0\1\156\3\0\1\157\73\0\1\160\1\0"+
|
||||
"\1\161\75\0\1\162\77\0\1\163\104\0\1\164\100\0"+
|
||||
"\1\165\71\0\1\166\17\0\7\65\1\0\3\65\1\0"+
|
||||
"\10\65\2\0\52\65\2\0\1\167\1\0\1\167\1\0"+
|
||||
"\1\170\6\0\2\167\1\0\1\167\1\0\1\167\3\0"+
|
||||
"\1\171\1\0\27\167\21\0\13\172\1\0\64\172\1\0"+
|
||||
"\2\72\1\0\2\72\6\0\3\72\1\0\1\72\1\0"+
|
||||
"\1\72\5\0\27\72\23\0\1\173\1\0\1\173\10\0"+
|
||||
"\2\173\1\0\1\173\1\0\1\173\5\0\27\173\22\0"+
|
||||
"\1\115\12\0\1\115\2\0\1\174\61\0\1\175\12\0"+
|
||||
"\1\175\4\0\1\175\40\0\1\175\16\0\2\100\1\0"+
|
||||
"\2\100\1\176\5\0\3\100\1\0\1\100\1\0\1\100"+
|
||||
"\5\0\27\100\22\0\2\101\1\0\2\101\6\0\3\101"+
|
||||
"\1\0\1\101\1\0\1\101\5\0\27\101\23\0\1\177"+
|
||||
"\1\0\1\177\10\0\2\177\1\0\1\177\1\0\1\177"+
|
||||
"\5\0\27\177\22\0\2\103\1\0\2\103\6\0\3\103"+
|
||||
"\1\0\1\103\1\0\1\103\5\0\27\103\23\0\1\200"+
|
||||
"\1\0\1\200\10\0\2\200\1\0\1\200\1\0\1\200"+
|
||||
"\5\0\27\200\21\0\13\106\1\0\64\106\12\201\1\202"+
|
||||
"\65\201\1\0\1\112\12\0\1\112\2\0\1\203\1\77"+
|
||||
"\12\0\1\77\45\0\2\113\11\0\1\113\1\0\1\113"+
|
||||
"\1\204\1\113\1\0\1\205\6\0\1\113\1\0\1\113"+
|
||||
"\1\0\1\205\1\113\5\0\1\113\5\0\1\113\3\0"+
|
||||
"\1\113\22\0\1\114\12\0\1\114\2\0\1\206\61\0"+
|
||||
"\1\115\12\0\1\115\3\0\1\77\12\0\1\77\44\0"+
|
||||
"\13\21\1\0\64\21\25\0\1\207\53\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\2\7\1\210\24\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\20\7\1\211"+
|
||||
"\6\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\27\7\2\0\1\212\17\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\4\7\1\213\22\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\5\7\1\214\21\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\1\215\26\7"+
|
||||
"\1\144\13\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\17\7\1\145\7\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\1\7\1\216\25\7\22\0\2\7"+
|
||||
"\1\0\1\7\5\0\1\7\1\146\5\7\1\147\2\7"+
|
||||
"\1\150\14\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\17\7\1\151\7\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\1\7\1\152\25\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\15\7\1\217\11\7\22\0\2\7\1\0\2\7"+
|
||||
"\5\0\7\7\1\153\17\7\62\0\1\154\16\0\1\155"+
|
||||
"\77\0\1\156\3\0\1\157\73\0\1\160\1\0\1\161"+
|
||||
"\75\0\1\162\77\0\1\163\104\0\1\164\100\0\1\165"+
|
||||
"\71\0\1\166\17\0\7\65\2\0\13\65\2\0\52\65"+
|
||||
"\2\0\1\167\1\0\1\167\1\0\1\170\6\0\2\167"+
|
||||
"\1\0\1\167\1\0\1\167\3\0\1\171\1\0\27\167"+
|
||||
"\21\0\7\172\1\0\70\172\1\0\2\72\1\0\2\72"+
|
||||
"\6\0\3\72\1\0\1\72\1\0\1\72\5\0\27\72"+
|
||||
"\21\0\6\173\2\0\70\173\1\0\1\115\12\0\1\115"+
|
||||
"\2\0\1\174\61\0\1\175\12\0\1\175\4\0\1\175"+
|
||||
"\40\0\1\175\15\0\6\100\1\176\1\0\70\100\1\0"+
|
||||
"\2\101\1\0\2\101\6\0\3\101\1\0\1\101\1\0"+
|
||||
"\1\101\5\0\27\101\21\0\6\177\2\0\70\177\1\0"+
|
||||
"\2\103\1\0\2\103\6\0\3\103\1\0\1\103\1\0"+
|
||||
"\1\103\5\0\27\103\21\0\6\200\2\0\70\200\7\106"+
|
||||
"\1\0\70\106\13\201\1\202\64\201\1\0\1\112\12\0"+
|
||||
"\1\112\2\0\1\203\1\77\12\0\1\77\45\0\2\113"+
|
||||
"\11\0\1\113\1\0\1\113\1\204\1\113\1\0\1\205"+
|
||||
"\6\0\1\113\1\0\1\113\1\0\1\205\1\113\5\0"+
|
||||
"\1\113\5\0\1\113\3\0\1\113\22\0\1\114\12\0"+
|
||||
"\1\114\2\0\1\206\61\0\1\115\12\0\1\115\3\0"+
|
||||
"\1\77\12\0\1\77\44\0\7\21\1\0\70\21\25\0"+
|
||||
"\1\207\53\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\2\7\1\210\24\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\20\7\1\211\6\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\27\7\2\0\1\212\17\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\4\7\1\213"+
|
||||
"\22\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\5\7\1\214\21\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\1\215\26\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\1\7"+
|
||||
"\1\220\10\7\1\221\10\7\1\222\3\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\11\7\1\223\1\7\1\224\13\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\5\7\1\225\21\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\10\7"+
|
||||
"\1\226\16\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\3\7\1\227\23\7"+
|
||||
"\1\216\25\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\15\7\1\217\11\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\3\7\1\230\5\7\1\231\15\7"+
|
||||
"\1\0\1\7\5\0\1\7\1\220\10\7\1\221\10\7"+
|
||||
"\1\222\3\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\11\7\1\223\1\7"+
|
||||
"\1\224\13\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\5\7\1\225\21\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\20\7\1\232\6\7\22\0\2\7"+
|
||||
"\1\0\1\7\5\0\10\7\1\226\16\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\13\7\1\233\13\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\1\234"+
|
||||
"\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\11\7\1\235\15\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\13\7\1\236\4\7\1\237\6\7\51\0"+
|
||||
"\1\240\3\0\1\241\123\0\1\242\77\0\1\243\20\0"+
|
||||
"\2\167\1\0\2\167\6\0\3\167\1\0\1\167\1\0"+
|
||||
"\1\167\5\0\27\167\23\0\1\244\1\0\1\244\10\0"+
|
||||
"\2\244\1\0\1\244\1\0\1\244\5\0\27\244\22\0"+
|
||||
"\2\173\1\0\2\173\1\245\5\0\3\173\1\0\1\173"+
|
||||
"\1\0\1\173\5\0\27\173\22\0\1\175\12\0\1\175"+
|
||||
"\64\0\2\177\1\0\2\177\1\246\5\0\3\177\1\0"+
|
||||
"\1\177\1\0\1\177\5\0\27\177\22\0\2\200\1\0"+
|
||||
"\2\200\1\247\5\0\3\200\1\0\1\200\1\0\1\200"+
|
||||
"\5\0\27\200\21\0\12\201\1\250\65\201\11\251\1\252"+
|
||||
"\1\202\65\251\1\0\1\115\12\0\1\115\64\0\2\253"+
|
||||
"\11\0\1\253\1\0\1\253\1\174\1\253\10\0\1\253"+
|
||||
"\1\0\1\253\2\0\1\253\5\0\1\253\5\0\1\253"+
|
||||
"\3\0\1\253\22\0\1\175\12\0\1\175\4\0\1\254"+
|
||||
"\40\0\1\254\34\0\1\174\60\0\25\207\1\255\52\207"+
|
||||
"\1\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\3\7\1\256\23\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\20\7\1\257\6\7\22\0\2\7\1\0\2\7"+
|
||||
"\5\0\3\7\1\227\23\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\3\7"+
|
||||
"\1\260\23\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\3\7\1\261\23\7"+
|
||||
"\1\230\5\7\1\231\15\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\20\7"+
|
||||
"\1\232\6\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\13\7\1\233\13\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\10\7\1\262\16\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\4\7\1\263\22\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\3\7"+
|
||||
"\1\264\23\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\11\7\1\265\15\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\3\7\1\266\23\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\4\7\1\267\22\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\7\7"+
|
||||
"\1\270\17\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\3\7\1\271\23\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\12\7\1\272\14\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\1\7\1\273\25\7\22\0\2\7\1\0\2\7"+
|
||||
"\6\0\3\7\1\0\1\7\1\0\1\7\5\0\1\274"+
|
||||
"\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\20\7\1\275\6\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\4\7\1\276\22\7\22\0\2\7\1\0"+
|
||||
"\1\0\1\7\5\0\1\234\26\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\4\7\1\277\22\7\22\0\2\300\1\0\2\300\6\0"+
|
||||
"\3\300\1\0\1\300\1\0\1\300\5\0\27\300\22\0"+
|
||||
"\2\244\1\0\2\244\1\301\5\0\3\244\1\0\1\244"+
|
||||
"\1\0\1\244\5\0\27\244\21\0\11\201\1\302\1\250"+
|
||||
"\65\201\12\251\1\303\65\251\1\0\2\253\11\0\1\253"+
|
||||
"\11\7\1\235\15\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\13\7\1\236"+
|
||||
"\4\7\1\237\6\7\51\0\1\240\3\0\1\241\123\0"+
|
||||
"\1\242\77\0\1\243\20\0\2\167\1\0\2\167\6\0"+
|
||||
"\3\167\1\0\1\167\1\0\1\167\5\0\27\167\21\0"+
|
||||
"\6\244\2\0\70\244\6\173\1\245\1\0\70\173\1\0"+
|
||||
"\1\175\12\0\1\175\63\0\6\177\1\246\1\0\70\177"+
|
||||
"\6\200\1\247\1\0\70\200\13\201\1\250\64\201\12\251"+
|
||||
"\1\252\1\202\64\251\1\0\1\115\12\0\1\115\64\0"+
|
||||
"\2\253\11\0\1\253\1\0\1\253\1\174\1\253\10\0"+
|
||||
"\1\253\1\0\1\253\2\0\1\253\5\0\1\253\5\0"+
|
||||
"\1\253\3\0\1\253\22\0\1\175\12\0\1\175\4\0"+
|
||||
"\1\254\40\0\1\254\34\0\1\174\60\0\25\207\1\255"+
|
||||
"\52\207\1\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\3\7\1\256\23\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\20\7\1\257\6\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\3\7\1\260\23\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\3\7\1\261"+
|
||||
"\23\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\10\7\1\262\16\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\4\7\1\263\22\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\3\7\1\264\23\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\11\7\1\265"+
|
||||
"\15\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\3\7\1\266\23\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\4\7\1\267\22\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\7\7\1\270\17\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\3\7\1\271"+
|
||||
"\23\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\12\7\1\272\14\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
"\1\7\5\0\1\7\1\273\25\7\22\0\2\7\1\0"+
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\1\274\26\7\22\0\2\7\1\0\2\7\6\0\3\7"+
|
||||
"\1\0\1\7\1\0\1\7\5\0\20\7\1\275\6\7"+
|
||||
"\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+
|
||||
"\1\0\1\7\5\0\4\7\1\276\22\7\22\0\2\7"+
|
||||
"\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+
|
||||
"\5\0\4\7\1\277\22\7\22\0\2\300\1\0\2\300"+
|
||||
"\6\0\3\300\1\0\1\300\1\0\1\300\5\0\27\300"+
|
||||
"\21\0\6\244\1\301\1\0\70\244\12\201\1\302\1\250"+
|
||||
"\64\201\13\251\1\303\64\251\1\0\2\253\11\0\1\253"+
|
||||
"\1\0\1\253\1\0\1\253\1\0\1\205\6\0\1\253"+
|
||||
"\1\0\1\253\1\0\1\205\1\253\5\0\1\253\5\0"+
|
||||
"\1\253\3\0\1\253\21\0\25\207\1\304\52\207\1\0"+
|
||||
@@ -412,7 +400,7 @@ class _JetLexer implements FlexLexer {
|
||||
"\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+
|
||||
"\3\7\1\316\23\7\22\0\2\7\1\0\2\7\6\0"+
|
||||
"\3\7\1\0\1\7\1\0\1\7\5\0\3\7\1\317"+
|
||||
"\23\7\21\0\11\251\1\252\1\303\65\251\25\207\1\320"+
|
||||
"\23\7\21\0\12\251\1\252\1\303\64\251\25\207\1\320"+
|
||||
"\52\207\1\0\2\7\1\0\2\7\6\0\3\7\1\0"+
|
||||
"\1\7\1\0\1\7\5\0\5\7\1\321\21\7\22\0"+
|
||||
"\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+
|
||||
@@ -473,13 +461,13 @@ class _JetLexer implements FlexLexer {
|
||||
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\4\0\1\11\15\1\2\11\21\1\1\11\6\1\10\11"+
|
||||
"\2\1\1\11\1\0\1\11\1\1\1\0\2\11\1\0"+
|
||||
"\1\1\1\0\1\1\1\0\1\1\1\0\1\11\2\1"+
|
||||
"\2\11\4\1\5\11\1\1\1\0\27\1\1\0\2\1"+
|
||||
"\10\11\1\1\1\0\2\11\1\0\1\11\1\1\1\11"+
|
||||
"\2\0\2\1\4\0\3\1\1\11\27\1\2\11\1\0"+
|
||||
"\3\11\1\0\1\1\1\11\1\1\2\0\22\1\3\11"+
|
||||
"\2\0\13\1\1\11\11\1";
|
||||
"\1\1\1\11\1\1\1\0\1\11\1\1\1\0\2\11"+
|
||||
"\1\0\1\1\1\0\1\1\1\0\1\1\1\0\1\11"+
|
||||
"\2\1\2\11\4\1\5\11\1\1\1\0\27\1\1\0"+
|
||||
"\2\1\10\11\1\1\1\0\2\11\1\0\1\11\1\1"+
|
||||
"\1\11\2\0\2\1\4\0\3\1\1\11\27\1\2\11"+
|
||||
"\1\0\3\11\1\0\1\1\1\11\1\1\2\0\22\1"+
|
||||
"\3\11\2\0\13\1\1\11\11\1";
|
||||
|
||||
private static int [] zzUnpackAttribute() {
|
||||
int [] result = new int[217];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
trait A {
|
||||
fun foo() : Int = 1
|
||||
fun foo2() : Int = 1
|
||||
fun foo1() : Int = 1
|
||||
val a : Int
|
||||
val a1 : Int
|
||||
@@ -12,7 +13,7 @@ trait A {
|
||||
abstract class B() : A {
|
||||
override fun <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>foo<!>() {
|
||||
}
|
||||
override fun foo() : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>Unit<!> {
|
||||
override fun foo2() : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>Unit<!> {
|
||||
}
|
||||
|
||||
override val a : <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>Double<!> = 1.dbl
|
||||
|
||||
@@ -10,7 +10,7 @@ fun test2() : Any = @a {return@a 1}
|
||||
fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> }
|
||||
fun test4(): fun(): Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> }
|
||||
fun test5(): Any = @{ return@ }
|
||||
fun test5(): Any = {<!RETURN_NOT_ALLOWED!>return 1<!>}
|
||||
fun test6(): Any = {<!RETURN_NOT_ALLOWED!>return 1<!>}
|
||||
|
||||
fun bbb() {
|
||||
return <!TYPE_MISMATCH!>1<!>
|
||||
@@ -34,7 +34,7 @@ fun intShortInfer() = 1
|
||||
fun intShort() : Int = 1
|
||||
//fun intBlockInfer() {1}
|
||||
fun intBlock() : Int {return 1}
|
||||
fun intBlock() : Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1<!>}
|
||||
fun intBlock1() : Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1<!>}
|
||||
|
||||
fun intString(): Int = <!TYPE_MISMATCH!>"s"<!>
|
||||
fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!>
|
||||
@@ -47,70 +47,70 @@ fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>()<!>}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true && false<!>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch1() : Int {
|
||||
return <!TYPE_MISMATCH!>true && false<!>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch2() : Int {
|
||||
<!UNREACHABLE_CODE!>(return <!ERROR_COMPILE_TIME_VALUE!>true<!>) && (return <!ERROR_COMPILE_TIME_VALUE!>false<!>)<!>
|
||||
}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch3() : Int {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true || false<!>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch4() : Int {
|
||||
return <!TYPE_MISMATCH!>true || false<!>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch5() : Int {
|
||||
<!UNREACHABLE_CODE!>(return <!ERROR_COMPILE_TIME_VALUE!>true<!>) || (return <!ERROR_COMPILE_TIME_VALUE!>false<!>)<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch1() : Int {
|
||||
return if (1 > 2) <!ERROR_COMPILE_TIME_VALUE!>1.0<!> else <!ERROR_COMPILE_TIME_VALUE!>2.0<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch2() : Int {
|
||||
return <!TYPE_MISMATCH!>if (1 > 2) 1<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch3() : Int {
|
||||
return <!TYPE_MISMATCH!>if (1 > 2) else 1<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch4() : Int {
|
||||
if (1 > 2)
|
||||
return <!ERROR_COMPILE_TIME_VALUE!>1.0<!>
|
||||
else return <!ERROR_COMPILE_TIME_VALUE!>2.0<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch5() : Int {
|
||||
if (1 > 2)
|
||||
return <!ERROR_COMPILE_TIME_VALUE!>1.0<!>
|
||||
return <!ERROR_COMPILE_TIME_VALUE!>2.0<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch6() : Int {
|
||||
if (1 > 2)
|
||||
else return <!ERROR_COMPILE_TIME_VALUE!>1.0<!>
|
||||
return <!ERROR_COMPILE_TIME_VALUE!>2.0<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch7() : Int {
|
||||
if (1 > 2)
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!>
|
||||
else <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>2.0<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch8() : Int {
|
||||
if (1 > 2)
|
||||
1.0
|
||||
else 2.0
|
||||
return 1
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch9() : Int {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>if (1 > 2)
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!><!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch10() : Int {
|
||||
return <!TYPE_MISMATCH!>if (1 > 2)
|
||||
1<!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch11() : Int {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>if (1 > 2)
|
||||
else <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!><!>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch12() : Int {
|
||||
if (1 > 2)
|
||||
return 1
|
||||
else return <!ERROR_COMPILE_TIME_VALUE!>1.0<!>
|
||||
@@ -166,9 +166,9 @@ fun f(): Int {
|
||||
if (1 < 2) { return 1 } else returnNothing()
|
||||
}
|
||||
|
||||
fun f(): Int = if (1 < 2) 1 else returnNothing()
|
||||
fun f1(): Int = if (1 < 2) 1 else returnNothing()
|
||||
|
||||
public fun <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>f<!>() = 1
|
||||
public fun <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>f2<!>() = 1
|
||||
class B() {
|
||||
protected fun <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>f<!>() = "ss"
|
||||
}
|
||||
|
||||
@@ -17,8 +17,4 @@ fun test(a : java.util.ArrayList<Int>) {
|
||||
|
||||
fun test(a : java.lang.Class<Int>) {
|
||||
|
||||
}
|
||||
|
||||
fun test(a : java.lang.Class<Int>) {
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class C() : A() {
|
||||
}
|
||||
}
|
||||
|
||||
fun f10(a : A?) {
|
||||
fun f101(a : A?) {
|
||||
if (a is C) {
|
||||
a.bar();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// KT-336 Can't infer type parameter for ArrayList in a generic function (Exception in type inference)
|
||||
// KT-335 Type inference fails on Collections.sort
|
||||
|
||||
import java.util.*
|
||||
import java.lang.Comparable as Comparable
|
||||
|
||||
fun <T : java.lang.Comparable<T>> List<T>.sort() {
|
||||
Collections.sort(this) // Error here
|
||||
}
|
||||
|
||||
fun <T> List<T>.plus(other : List<T>) : List<T> {
|
||||
val result = ArrayList(this)
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// KT-385 type inference does not work properly`
|
||||
// KT-109 Good code is red: type arguments are not inferred
|
||||
// KT-441 Exception in type inference when multiple overloads accepting an integer literal are accessible
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun <T> Iterator<T>.foreach(operation: fun(element: T) : Unit) : Unit = while(hasNext) operation(next())
|
||||
|
||||
fun <T> Iterator<T>.foreach(operation: fun(index: Int, element: T) : Unit) : Unit {
|
||||
var k = 0
|
||||
while(hasNext)
|
||||
operation(k++, next())
|
||||
}
|
||||
|
||||
fun <T> Iterable<T>.foreach(operation: fun(element: T) : Unit) : Unit = iterator() foreach operation
|
||||
|
||||
fun <T> Iterable<T>.foreach(operation: fun(index: Int, element: T) : Unit) : Unit = iterator() foreach operation
|
||||
|
||||
fun box() : String {
|
||||
return generic_invoker( { () : String => "OK"} )
|
||||
}
|
||||
|
||||
fun <T> generic_invoker(gen : fun () : T) : T {
|
||||
return gen()
|
||||
}
|
||||
|
||||
fun println(message : Int) { System.out?.println(message) }
|
||||
fun println(message : Long) { System.out?.println(message) }
|
||||
inline fun run<T>(body : fun() : T) : T = body()
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
|
||||
println(run { 1 })
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// http://youtrack.jetbrains.net/issue/KT-424
|
||||
|
||||
class A {
|
||||
<!CONFLICTING_OVERLOADS!>fun a(a: Int): Int<!> = 0
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun a(a: Int)<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun b()<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun b()<!> {
|
||||
}
|
||||
}
|
||||
|
||||
namespace deepSpace {
|
||||
<!CONFLICTING_OVERLOADS!>fun c(s: String)<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun c(s: String)<!> {
|
||||
}
|
||||
|
||||
class B {
|
||||
<!CONFLICTING_OVERLOADS!>fun d(s: String)<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun d(s: String)<!> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check no error in overload in different namespaces
|
||||
|
||||
namespace ns1 {
|
||||
fun e() = 1
|
||||
}
|
||||
|
||||
namespace ns2 {
|
||||
fun e() = 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace dollar
|
||||
|
||||
open class `$$$$$`() {
|
||||
}
|
||||
open class `$`() {
|
||||
}
|
||||
open class `$$`(`$$$$` : `$$$$$`?) : `$`() {
|
||||
val `$$$` : `$$$$$`?
|
||||
{
|
||||
$`$$$` = `$$$$`
|
||||
}
|
||||
open public fun `$$$$$$`() : `$$$$$`? {
|
||||
return `$$$`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// http://youtrack.jetbrains.net/issue/KT-451
|
||||
// KT-451 Incorrect character literals cause assertion failures
|
||||
|
||||
fun ff() {
|
||||
val b = <!ERROR_COMPILE_TIME_VALUE!>''<!>
|
||||
val c = <!ERROR_COMPILE_TIME_VALUE!>'23'<!>
|
||||
val d = <!ERROR_COMPILE_TIME_VALUE!>'a<!>
|
||||
val e = <!ERROR_COMPILE_TIME_VALUE!>'ab<!>
|
||||
val f = <!ERROR_COMPILE_TIME_VALUE!>'\'<!>
|
||||
}
|
||||
|
||||
fun test() {
|
||||
'a'
|
||||
'\n'
|
||||
'\t'
|
||||
'\b'
|
||||
'\r'
|
||||
'\"'
|
||||
'\''
|
||||
'\\'
|
||||
'\$'
|
||||
<!ERROR_COMPILE_TIME_VALUE!>'\x'<!>
|
||||
<!ERROR_COMPILE_TIME_VALUE!>'\123'<!>
|
||||
<!ERROR_COMPILE_TIME_VALUE!>'\ra'<!>
|
||||
<!ERROR_COMPILE_TIME_VALUE!>'\000'<!>
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ fun test(a : A?) {
|
||||
a<!UNNECESSARY_SAFE_CALL!>?.<!>buzz() // warning
|
||||
}
|
||||
|
||||
fun A.test() {
|
||||
fun A.test2() {
|
||||
foo()
|
||||
bar()
|
||||
buzz()
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
[`return`] fun `namespace`() {
|
||||
`class`()
|
||||
}
|
||||
|
||||
class `$`
|
||||
class `$$`
|
||||
class ` `
|
||||
class `1`
|
||||
|
||||
@@ -29,4 +29,32 @@ JetFile: QuotedIdentifiers.jet
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('`$`')
|
||||
PsiWhiteSpace('\n')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('`$$`')
|
||||
PsiWhiteSpace('\n')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('` `')
|
||||
PsiWhiteSpace('\n')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('`1`')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class JetPsiUtilTest extends TestCase {
|
||||
|
||||
public void testUnquotedIdentifier() {
|
||||
Assert.assertEquals("", JetPsiUtil.unquoteIdentifier(""));
|
||||
Assert.assertEquals("a2", JetPsiUtil.unquoteIdentifier("a2"));
|
||||
Assert.assertEquals("", JetPsiUtil.unquoteIdentifier("``"));
|
||||
Assert.assertEquals("a2", JetPsiUtil.unquoteIdentifier("`a2`"));
|
||||
}
|
||||
|
||||
public void testUnquotedIdentifierOrFieldReference() {
|
||||
Assert.assertEquals("", JetPsiUtil.unquoteIdentifierOrFieldReference(""));
|
||||
Assert.assertEquals("a2", JetPsiUtil.unquoteIdentifierOrFieldReference("a2"));
|
||||
Assert.assertEquals("", JetPsiUtil.unquoteIdentifierOrFieldReference("``"));
|
||||
Assert.assertEquals("a2", JetPsiUtil.unquoteIdentifierOrFieldReference("`a2`"));
|
||||
Assert.assertEquals("$a2", JetPsiUtil.unquoteIdentifierOrFieldReference("$a2"));
|
||||
Assert.assertEquals("$a2", JetPsiUtil.unquoteIdentifierOrFieldReference("$`a2`"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package org.jetbrains.jet.types;
|
||||
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
import org.jetbrains.jet.lang.resolve.ClassDescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.OverloadUtil;
|
||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class JetOverloadTest extends JetLiteFixture {
|
||||
|
||||
private ModuleDescriptor root = new ModuleDescriptor("test_root");
|
||||
private JetStandardLibrary library;
|
||||
private JetSemanticServices semanticServices;
|
||||
private ClassDescriptorResolver classDescriptorResolver;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
library = JetStandardLibrary.getJetStandardLibrary(getProject());
|
||||
semanticServices = JetSemanticServices.createSemanticServices(library);
|
||||
classDescriptorResolver = semanticServices.getClassDescriptorResolver(JetTestUtils.DUMMY_TRACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JetTestCaseBuilder.getTestDataPathBase();
|
||||
}
|
||||
|
||||
public void testBasic() throws Exception {
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a() : Int",
|
||||
"fun a() : Int");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a() : Int",
|
||||
"fun a() : Any");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1>() : T1",
|
||||
"fun a<T>() : T");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1>(a : T1) : T1",
|
||||
"fun a<T>(a : T) : T");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1, X : T1>(a : T1) : T1",
|
||||
"fun a<T, Y : T>(a : T) : T");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1, X : T1>(a : T1) : T1",
|
||||
"fun a<T, Y : T>(a : T) : Y");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
assertOverloadable(
|
||||
"fun ab() : Int",
|
||||
"fun a() : Int");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a() : Int",
|
||||
"fun a() : Any");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a(a : Int) : Int",
|
||||
"fun a() : Int");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a() : Int",
|
||||
"fun a(a : Int) : Int");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a(a : Int?) : Int",
|
||||
"fun a(a : Int) : Int");
|
||||
|
||||
// XXX: different from overridable
|
||||
/*
|
||||
assertNotOverloadable(
|
||||
"fun a<T>(a : Int) : Int",
|
||||
"fun a(a : Int) : Int");
|
||||
*/
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : T1>(a : T1) : T1",
|
||||
"fun a<T, Y>(a : T) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : T1>(a : T1) : T1",
|
||||
"fun a<T, Y : T>(a : Y) : T");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1, X : T1>(a : T1) : X",
|
||||
"fun a<T, Y : T>(a : T) : T");
|
||||
|
||||
assertNotOverloadable(
|
||||
"fun a<T1, X : Array<out T1>>(a : Array<in T1>) : T1",
|
||||
"fun a<T, Y : Array<out T>>(a : Array<in T>) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : Array<T1>>(a : Array<in T1>) : T1",
|
||||
"fun a<T, Y : Array<out T>>(a : Array<in T>) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : Array<out T1>>(a : Array<in T1>) : T1",
|
||||
"fun a<T, Y : Array<in T>>(a : Array<in T>) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : Array<out T1>>(a : Array<in T1>) : T1",
|
||||
"fun a<T, Y : Array<*>>(a : Array<in T>) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : Array<out T1>>(a : Array<in T1>) : T1",
|
||||
"fun a<T, Y : Array<out T>>(a : Array<out T>) : T");
|
||||
|
||||
assertOverloadable(
|
||||
"fun a<T1, X : Array<out T1>>(a : Array<*>) : T1",
|
||||
"fun a<T, Y : Array<out T>>(a : Array<in T>) : T");
|
||||
|
||||
}
|
||||
|
||||
private void assertNotOverloadable(String funA, String funB) {
|
||||
assertOverloadabilityRelation(funA, funB, true);
|
||||
}
|
||||
|
||||
private void assertOverloadable(String funA, String funB) {
|
||||
assertOverloadabilityRelation(funA, funB, false);
|
||||
}
|
||||
|
||||
private void assertOverloadabilityRelation(String funA, String funB, boolean expectedIsError) {
|
||||
FunctionDescriptor a = makeFunction(funA);
|
||||
FunctionDescriptor b = makeFunction(funB);
|
||||
{
|
||||
OverloadUtil.OverloadCompatibilityInfo overloadableWith = OverloadUtil.isOverloadble(a, b);
|
||||
assertEquals(overloadableWith.getMessage(), expectedIsError, !overloadableWith.isSuccess());
|
||||
}
|
||||
{
|
||||
OverloadUtil.OverloadCompatibilityInfo overloadableWith = OverloadUtil.isOverloadble(b, a);
|
||||
assertEquals(overloadableWith.getMessage(), expectedIsError, !overloadableWith.isSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
private FunctionDescriptor makeFunction(String funDecl) {
|
||||
JetNamedFunction function = JetPsiFactory.createFunction(getProject(), funDecl);
|
||||
return classDescriptorResolver.resolveFunctionDescriptor(root, library.getLibraryScope(), function);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -67,6 +67,13 @@ public class JetOverridingTest extends JetLiteFixture {
|
||||
"fun a() : Int",
|
||||
"fun a() : Any");
|
||||
|
||||
// return types are not cheked in the utility
|
||||
/*
|
||||
assertNotOverridable(
|
||||
"fun a() : Any",
|
||||
"fun a() : Int");
|
||||
*/
|
||||
|
||||
assertNotOverridable(
|
||||
"fun a(a : Int) : Int",
|
||||
"fun a() : Int");
|
||||
|
||||
@@ -31,7 +31,7 @@ fun intShortInfer() = 1
|
||||
fun intShort() : Int = 1
|
||||
//fun intBlockInfer() {1}
|
||||
fun intBlock() : Int {return 1}
|
||||
fun intBlock() : Int {<error>1</error>}
|
||||
fun intBlock1() : Int {<error>1</error>}
|
||||
|
||||
fun intString(): Int = <error>"s"</error>
|
||||
fun intFunctionLiteral(): Int = <error>{ 10 }</error>
|
||||
@@ -44,70 +44,70 @@ fun blockReturnValueTypeMismatchUnit() : Int {return <error>()</error>}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
<error>true && false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch1() : Int {
|
||||
return <error>true && false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch2() : Int {
|
||||
<error>(return <error>true</error>) && (return <error>false</error>)</error>
|
||||
}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch3() : Int {
|
||||
<error>true || false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch4() : Int {
|
||||
return <error>true || false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
fun blockAndAndMismatch5() : Int {
|
||||
<error>(return <error>true</error>) || (return <error>false</error>)</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch1() : Int {
|
||||
return if (1 > 2) <error>1.0</error> else <error>2.0</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch2() : Int {
|
||||
return <error>if (1 > 2) 1</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch3() : Int {
|
||||
return <error>if (1 > 2) else 1</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch4() : Int {
|
||||
if (1 > 2)
|
||||
return <error>1.0</error>
|
||||
else return <error>2.0</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch5() : Int {
|
||||
if (1 > 2)
|
||||
return <error>1.0</error>
|
||||
return <error>2.0</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch6() : Int {
|
||||
if (1 > 2)
|
||||
else return <error>1.0</error>
|
||||
return <error>2.0</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch7() : Int {
|
||||
if (1 > 2)
|
||||
<error>1.0</error>
|
||||
else <error>2.0</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch8() : Int {
|
||||
if (1 > 2)
|
||||
1.0
|
||||
else 2.0
|
||||
return 1
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch9() : Int {
|
||||
<error>if (1 > 2)
|
||||
<error>1.0</error></error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch10() : Int {
|
||||
return <error>if (1 > 2)
|
||||
1</error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch11() : Int {
|
||||
<error>if (1 > 2)
|
||||
else <error>1.0</error></error>
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
fun blockReturnValueTypeMatch12() : Int {
|
||||
if (1 > 2)
|
||||
return 1
|
||||
else return <error>1.0</error>
|
||||
@@ -163,4 +163,4 @@ fun f(): Int {
|
||||
if (1 < 2) { return 1 } else returnNothing()
|
||||
}
|
||||
|
||||
fun f(): Int = if (1 < 2) 1 else returnNothing()
|
||||
fun f1(): Int = if (1 < 2) 1 else returnNothing()
|
||||
|
||||
@@ -44,7 +44,7 @@ class C() : A() {
|
||||
}
|
||||
}
|
||||
|
||||
fun f10(a : A?) {
|
||||
fun f101(a : A?) {
|
||||
if (a is C) {
|
||||
<info descr="Automatically cast to C">a</info>.bar();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user