Resolve for "!"
This commit is contained in:
@@ -5,39 +5,58 @@ class Array<T> {
|
|||||||
fun set(index : Int, value : T) : Unit
|
fun set(index : Int, value : T) : Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
class Boolean {
|
virtual class Comparable<in T> {
|
||||||
|
fun compareTo(other : T) : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class String {
|
class Boolean : Comparable<Boolean> {
|
||||||
|
fun not() : Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
class String : Comparable<String> {
|
||||||
fun get(index : Int) : Char
|
fun get(index : Int) : Char
|
||||||
val length : Int
|
val length : Int
|
||||||
|
|
||||||
fun plus(other : Any?) : String
|
fun plus(other : Any?) : String
|
||||||
}
|
}
|
||||||
|
|
||||||
class Double {
|
class Double : Comparable<Double> {
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
}
|
}
|
||||||
|
|
||||||
class Float {
|
class Float : Comparable<Float> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
}
|
}
|
||||||
|
|
||||||
class Long {
|
class Long : Comparable<Long> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
fun compareTo(other : Float) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
fun plus(other : Long) : Long
|
fun plus(other : Long) : Long
|
||||||
}
|
}
|
||||||
|
|
||||||
class Int {
|
class Int : Comparable<Int> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
fun compareTo(other : Float) : Int
|
||||||
|
fun compareTo(other : Long) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
fun plus(other : Long) : Long
|
fun plus(other : Long) : Long
|
||||||
fun plus(other : Int) : Int
|
fun plus(other : Int) : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class Char {
|
class Char : Comparable<Char> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
fun compareTo(other : Float) : Int
|
||||||
|
fun compareTo(other : Long) : Int
|
||||||
|
fun compareTo(other : Int) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
fun plus(other : Long) : Long
|
fun plus(other : Long) : Long
|
||||||
@@ -45,7 +64,12 @@ class Char {
|
|||||||
fun plus(other : Char) : Char
|
fun plus(other : Char) : Char
|
||||||
}
|
}
|
||||||
|
|
||||||
class Short {
|
class Short : Comparable<Char> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
fun compareTo(other : Float) : Int
|
||||||
|
fun compareTo(other : Long) : Int
|
||||||
|
fun compareTo(other : Int) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
fun plus(other : Long) : Long
|
fun plus(other : Long) : Long
|
||||||
@@ -53,7 +77,13 @@ class Short {
|
|||||||
fun plus(other : Short) : Short
|
fun plus(other : Short) : Short
|
||||||
}
|
}
|
||||||
|
|
||||||
class Byte {
|
class Byte : Comparable<Char> {
|
||||||
|
fun compareTo(other : Double) : Int
|
||||||
|
fun compareTo(other : Float) : Int
|
||||||
|
fun compareTo(other : Long) : Int
|
||||||
|
fun compareTo(other : Int) : Int
|
||||||
|
fun compareTo(other : Short) : Int
|
||||||
|
|
||||||
fun plus(other : Double) : Double
|
fun plus(other : Double) : Double
|
||||||
fun plus(other : Float) : Float
|
fun plus(other : Float) : Float
|
||||||
fun plus(other : Long) : Long
|
fun plus(other : Long) : Long
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ public class LabelsAnnotator implements Annotator {
|
|||||||
element.accept(new JetVisitor() {
|
element.accept(new JetVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public void visitPrefixExpression(JetPrefixExpression expression) {
|
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||||
ASTNode operationTokenNode = expression.getOperationTokenNode();
|
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||||
if (JetTokens.LABELS.contains(operationTokenNode.getElementType())) {
|
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
|
||||||
holder.createInfoAnnotation(operationTokenNode, null).setTextAttributes(JetHighlighter.JET_LABEL_IDENTIFIER);
|
holder.createInfoAnnotation(operationSign, null).setTextAttributes(JetHighlighter.JET_LABEL_IDENTIFIER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -263,9 +263,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
while (!myBuilder.newlineBeforeCurrentToken() && atSet(precedence.getOperations())) {
|
while (!myBuilder.newlineBeforeCurrentToken() && atSet(precedence.getOperations())) {
|
||||||
IElementType operation = tt();
|
IElementType operation = tt();
|
||||||
|
|
||||||
PsiBuilder.Marker operationReference = mark();
|
parseOperationReference();
|
||||||
advance(); // operation
|
|
||||||
operationReference.done(OPERATION_REFERENCE);
|
|
||||||
|
|
||||||
JetNodeType resultType = precedence.parseRightHandSide(operation, this);
|
JetNodeType resultType = precedence.parseRightHandSide(operation, this);
|
||||||
expression.done(resultType);
|
expression.done(resultType);
|
||||||
@@ -291,7 +289,8 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
} else if (atSet(Precedence.PREFIX.getOperations())) {
|
} else if (atSet(Precedence.PREFIX.getOperations())) {
|
||||||
PsiBuilder.Marker expression = mark();
|
PsiBuilder.Marker expression = mark();
|
||||||
advance(); // operation
|
|
||||||
|
parseOperationReference();
|
||||||
|
|
||||||
parsePrefixExpression();
|
parsePrefixExpression();
|
||||||
expression.done(PREFIX_EXPRESSION);
|
expression.done(PREFIX_EXPRESSION);
|
||||||
@@ -323,7 +322,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
parseArrayAccess();
|
parseArrayAccess();
|
||||||
expression.done(ARRAY_ACCESS_EXPRESSION);
|
expression.done(ARRAY_ACCESS_EXPRESSION);
|
||||||
} else if (atSet(Precedence.POSTFIX.getOperations())) {
|
} else if (atSet(Precedence.POSTFIX.getOperations())) {
|
||||||
advance(); // operation
|
parseOperationReference();
|
||||||
expression.done(POSTFIX_EXPRESSION);
|
expression.done(POSTFIX_EXPRESSION);
|
||||||
} else if (parseCallWithClosure()) {
|
} else if (parseCallWithClosure()) {
|
||||||
parseCallWithClosure();
|
parseCallWithClosure();
|
||||||
@@ -380,6 +379,12 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
expression.drop();
|
expression.drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void parseOperationReference() {
|
||||||
|
PsiBuilder.Marker operationReference = mark();
|
||||||
|
advance(); // operation
|
||||||
|
operationReference.done(OPERATION_REFERENCE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* expression (label? functionLiteral)?
|
* expression (label? functionLiteral)?
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ public abstract class JetNamedDeclaration extends JetDeclaration implements PsiN
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextRange getRangeInElement() {
|
public TextRange getRangeInElement() {
|
||||||
return getElement().getTextRange().shiftRight(getElement().getTextOffset());
|
PsiElement element = getElement();
|
||||||
|
if (element == null) return null;
|
||||||
|
return element.getTextRange().shiftRight(element.getTextOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package org.jetbrains.jet.lang.psi;
|
|||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
|
||||||
import org.jetbrains.jet.lexer.JetTokens;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
@@ -27,14 +25,7 @@ public class JetPostfixExpression extends JetExpression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ASTNode getOperationTokenNode() {
|
public JetSimpleNameExpression getOperationSign() {
|
||||||
ASTNode operationNode = getNode().findChildByType(JetTokens.OPERATIONS);
|
return (JetSimpleNameExpression) findChildByType(JetNodeTypes.OPERATION_REFERENCE);
|
||||||
assert operationNode != null;
|
|
||||||
return operationNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public JetToken getOperationSign() {
|
|
||||||
return (JetToken) getOperationTokenNode().getElementType();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.jetbrains.jet.lang.psi;
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
import org.jetbrains.jet.lexer.JetTokens;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
@@ -20,20 +20,16 @@ public class JetPrefixExpression extends JetExpression {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetExpression getBaseExpression() {
|
public JetExpression getBaseExpression() {
|
||||||
JetExpression answer = findChildByClass(JetExpression.class);
|
PsiElement expression = getOperationSign().getNextSibling();
|
||||||
assert answer != null;
|
while (expression != null && false == expression instanceof JetExpression) {
|
||||||
return answer;
|
expression = expression.getNextSibling();
|
||||||
|
}
|
||||||
|
assert expression != null;
|
||||||
|
return (JetExpression) expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ASTNode getOperationTokenNode() {
|
public JetSimpleNameExpression getOperationSign() {
|
||||||
ASTNode operationNode = getNode().findChildByType(JetTokens.OPERATIONS);
|
return (JetSimpleNameExpression) findChildByType(JetNodeTypes.OPERATION_REFERENCE);
|
||||||
assert operationNode != null;
|
|
||||||
return operationNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public JetToken getOperationSign() {
|
|
||||||
return (JetToken) getOperationTokenNode().getElementType();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,22 +61,33 @@ public class ClassDescriptorResolver {
|
|||||||
List<TypeParameterDescriptor> typeParameters
|
List<TypeParameterDescriptor> typeParameters
|
||||||
= resolveTypeParameters(descriptor, parameterScope, classElement.getTypeParameters());
|
= resolveTypeParameters(descriptor, parameterScope, classElement.getTypeParameters());
|
||||||
|
|
||||||
|
boolean open = classElement.hasModifier(JetTokens.OPEN_KEYWORD);
|
||||||
|
List<JetType> supertypes = new ArrayList<JetType>();
|
||||||
|
TypeConstructorImpl typeConstructor = new TypeConstructorImpl(
|
||||||
|
descriptor,
|
||||||
|
AttributeResolver.INSTANCE.resolveAttributes(classElement.getModifierList()),
|
||||||
|
!open,
|
||||||
|
classElement.getName(),
|
||||||
|
typeParameters,
|
||||||
|
supertypes);
|
||||||
|
descriptor.setTypeConstructor(
|
||||||
|
typeConstructor
|
||||||
|
);
|
||||||
|
|
||||||
List<JetDelegationSpecifier> delegationSpecifiers = classElement.getDelegationSpecifiers();
|
List<JetDelegationSpecifier> delegationSpecifiers = classElement.getDelegationSpecifiers();
|
||||||
// TODO : assuming that the hierarchy is acyclic
|
// TODO : assuming that the hierarchy is acyclic
|
||||||
Collection<? extends JetType> superclasses = delegationSpecifiers.isEmpty()
|
Collection<? extends JetType> superclasses = delegationSpecifiers.isEmpty()
|
||||||
? Collections.singleton(JetStandardClasses.getAnyType())
|
? Collections.singleton(JetStandardClasses.getAnyType())
|
||||||
: resolveTypes(parameterScope, delegationSpecifiers);
|
: resolveTypes(parameterScope, delegationSpecifiers);
|
||||||
boolean open = classElement.hasModifier(JetTokens.OPEN_KEYWORD);
|
|
||||||
|
|
||||||
descriptor.setTypeConstructor(
|
// TODO : UGLY HACK
|
||||||
new TypeConstructor(
|
supertypes.addAll(superclasses);
|
||||||
descriptor,
|
|
||||||
AttributeResolver.INSTANCE.resolveAttributes(classElement.getModifierList()),
|
|
||||||
!open,
|
// TODO : importing may be a bad idea
|
||||||
classElement.getName(),
|
for (JetType supertype : superclasses) {
|
||||||
typeParameters,
|
parameterScope.importScope(supertype.getMemberScope());
|
||||||
superclasses)
|
}
|
||||||
);
|
|
||||||
|
|
||||||
trace.recordDeclarationResolution(classElement, descriptor);
|
trace.recordDeclarationResolution(classElement, descriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,13 @@ public class JavaClassMembersScope implements JetScope {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClassDescriptor getClass(@NotNull String name) {
|
public ClassDescriptor getClass(@NotNull String name) {
|
||||||
throw new UnsupportedOperationException(); // TODO
|
for (PsiClass innerClass : psiClass.getAllInnerClasses()) {
|
||||||
|
if (name.equals(innerClass.getName())) {
|
||||||
|
if (innerClass.hasModifierProperty(PsiModifier.STATIC) != staticMembers) return null;
|
||||||
|
return semanticServices.getDescriptorResolver().resolveClass(innerClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
|
|||||||
public final ClassDescriptorImpl initialize(boolean sealed,
|
public final ClassDescriptorImpl initialize(boolean sealed,
|
||||||
List<TypeParameterDescriptor> typeParameters,
|
List<TypeParameterDescriptor> typeParameters,
|
||||||
Collection<? extends JetType> superclasses, JetScope memberDeclarations) {
|
Collection<? extends JetType> superclasses, JetScope memberDeclarations) {
|
||||||
this.typeConstructor = new TypeConstructor(this, getAttributes(), sealed, getName(), typeParameters, superclasses);
|
this.typeConstructor = new TypeConstructorImpl(this, getAttributes(), sealed, getName(), typeParameters, superclasses);
|
||||||
this.memberDeclarations = memberDeclarations;
|
this.memberDeclarations = memberDeclarations;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class ErrorType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static JetType createErrorType(String debugMessage, JetScope memberScope) {
|
private static JetType createErrorType(String debugMessage, JetScope memberScope) {
|
||||||
return new ErrorTypeImpl(new TypeConstructor(null, Collections.<Attribute>emptyList(), false, "[ERROR : " + debugMessage + "]", Collections.<TypeParameterDescriptor>emptyList(), Collections.<JetType>emptyList()), memberScope);
|
return new ErrorTypeImpl(new TypeConstructorImpl(null, Collections.<Attribute>emptyList(), false, "[ERROR : " + debugMessage + "]", Collections.<TypeParameterDescriptor>emptyList(), Collections.<JetType>emptyList()), memberScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JetType createWrongVarianceErrorType(TypeProjection value) {
|
public static JetType createWrongVarianceErrorType(TypeProjection value) {
|
||||||
|
|||||||
@@ -39,399 +39,13 @@ public class JetTypeInferrer {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, final boolean preferBlock) {
|
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, final boolean preferBlock) {
|
||||||
final JetType[] result = new JetType[1];
|
TypeInferrerVisitor visitor = new TypeInferrerVisitor(scope, preferBlock);
|
||||||
expression.accept(new JetVisitor() {
|
expression.accept(visitor);
|
||||||
@Override
|
JetType result = visitor.getResult();
|
||||||
public void visitReferenceExpression(JetSimpleNameExpression expression) {
|
if (result != null) {
|
||||||
// TODO : other members
|
trace.recordExpressionType(expression, result);
|
||||||
// TODO : type substitutions???
|
|
||||||
String referencedName = expression.getReferencedName();
|
|
||||||
PropertyDescriptor property = scope.getProperty(referencedName);
|
|
||||||
if (property != null) {
|
|
||||||
trace.recordReferenceResolution(expression, property);
|
|
||||||
result[0] = property.getType();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
NamespaceDescriptor namespace = scope.getNamespace(referencedName);
|
|
||||||
if (namespace != null) {
|
|
||||||
trace.recordReferenceResolution(expression, namespace);
|
|
||||||
result[0] = namespace.getNamespaceType();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
semanticServices.getErrorHandler().unresolvedReference(expression);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
|
||||||
if (preferBlock && !expression.hasParameterSpecification()) {
|
|
||||||
result[0] = getBlockReturnedType(scope, expression.getBody());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(scope.getContainingDeclaration(), Collections.<Attribute>emptyList(), "<anonymous>");
|
|
||||||
|
|
||||||
JetTypeReference returnTypeRef = expression.getReturnTypeRef();
|
|
||||||
|
|
||||||
JetTypeReference receiverTypeRef = expression.getReceiverTypeRef();
|
|
||||||
final JetType receiverType;
|
|
||||||
if (receiverTypeRef != null) {
|
|
||||||
receiverType = typeResolver.resolveType(scope, receiverTypeRef);
|
|
||||||
} else {
|
|
||||||
receiverType = scope.getThisType();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<JetElement> body = expression.getBody();
|
|
||||||
final Map<String, PropertyDescriptor> parameterDescriptors = new HashMap<String, PropertyDescriptor>();
|
|
||||||
List<JetType> parameterTypes = new ArrayList<JetType>();
|
|
||||||
for (JetParameter parameter : expression.getParameters()) {
|
|
||||||
JetTypeReference typeReference = parameter.getTypeReference();
|
|
||||||
if (typeReference == null) {
|
|
||||||
throw new UnsupportedOperationException("Type inference for parameters is not implemented yet");
|
|
||||||
}
|
|
||||||
PropertyDescriptor propertyDescriptor = classDescriptorResolver.resolvePropertyDescriptor(functionDescriptor, scope, parameter);
|
|
||||||
parameterDescriptors.put(parameter.getName(), propertyDescriptor);
|
|
||||||
parameterTypes.add(propertyDescriptor.getType());
|
|
||||||
}
|
|
||||||
JetType returnType;
|
|
||||||
if (returnTypeRef != null) {
|
|
||||||
returnType = typeResolver.resolveType(scope, returnTypeRef);
|
|
||||||
} else {
|
|
||||||
WritableScope writableScope = new WritableScope(scope, functionDescriptor);
|
|
||||||
for (PropertyDescriptor propertyDescriptor : parameterDescriptors.values()) {
|
|
||||||
writableScope.addPropertyDescriptor(propertyDescriptor);
|
|
||||||
}
|
|
||||||
writableScope.setThisType(receiverType);
|
|
||||||
returnType = getBlockReturnedType(writableScope, body);
|
|
||||||
}
|
|
||||||
result[0] = JetStandardClasses.getFunctionType(null, receiverTypeRef == null ? null : receiverType, parameterTypes, returnType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
|
||||||
result[0] = getType(scope, expression.getExpression(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitConstantExpression(JetConstantExpression expression) {
|
|
||||||
IElementType elementType = expression.getNode().getElementType();
|
|
||||||
JetStandardLibrary standardLibrary = semanticServices.getStandardLibrary();
|
|
||||||
if (elementType == JetNodeTypes.INTEGER_CONSTANT) {
|
|
||||||
result[0] = standardLibrary.getIntType();
|
|
||||||
} else if (elementType == JetNodeTypes.LONG_CONSTANT) {
|
|
||||||
result[0] = standardLibrary.getLongType();
|
|
||||||
} else if (elementType == JetNodeTypes.FLOAT_CONSTANT) {
|
|
||||||
String text = expression.getText();
|
|
||||||
assert text.length() > 0;
|
|
||||||
char lastChar = text.charAt(text.length() - 1);
|
|
||||||
if (lastChar == 'f' || lastChar == 'F') {
|
|
||||||
result[0] = standardLibrary.getFloatType();
|
|
||||||
} else {
|
|
||||||
result[0] = standardLibrary.getDoubleType();
|
|
||||||
}
|
|
||||||
} else if (elementType == JetNodeTypes.BOOLEAN_CONSTANT) {
|
|
||||||
result[0] = standardLibrary.getBooleanType();
|
|
||||||
} else if (elementType == JetNodeTypes.CHARACTER_CONSTANT) {
|
|
||||||
result[0] = standardLibrary.getCharType();
|
|
||||||
} else if (elementType == JetNodeTypes.STRING_CONSTANT) {
|
|
||||||
result[0] = standardLibrary.getStringType();
|
|
||||||
} else if (elementType == JetNodeTypes.NULL) {
|
|
||||||
result[0] = JetStandardClasses.getNullableNothingType();
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Unsupported constant: " + expression);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitThrowExpression(JetThrowExpression expression) {
|
|
||||||
result[0] = JetStandardClasses.getNothingType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitReturnExpression(JetReturnExpression expression) {
|
|
||||||
JetExpression returnedExpression = expression.getReturnedExpression();
|
|
||||||
if (returnedExpression != null) {
|
|
||||||
getType(scope, returnedExpression, false);
|
|
||||||
}
|
|
||||||
result[0] = JetStandardClasses.getNothingType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitBreakExpression(JetBreakExpression expression) {
|
|
||||||
result[0] = JetStandardClasses.getNothingType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitContinueExpression(JetContinueExpression expression) {
|
|
||||||
result[0] = JetStandardClasses.getNothingType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitTypeofExpression(JetTypeofExpression expression) {
|
|
||||||
throw new UnsupportedOperationException("Return some reflection interface"); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
|
||||||
if (expression.getOperationReference().getReferencedNameElementType() == JetTokens.COLON) {
|
|
||||||
JetType actualType = getType(scope, expression.getLeft(), false);
|
|
||||||
JetType expectedType = typeResolver.resolveType(scope, expression.getRight());
|
|
||||||
if (actualType != null && !semanticServices.getTypeChecker().isSubtypeOf(actualType, expectedType)) {
|
|
||||||
// TODO
|
|
||||||
semanticServices.getErrorHandler().typeMismatch(expression.getLeft(), expectedType, actualType);
|
|
||||||
}
|
|
||||||
result[0] = expectedType;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw new UnsupportedOperationException(); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitIfExpression(JetIfExpression expression) {
|
|
||||||
// TODO : check condition type
|
|
||||||
// TODO : change types according to is and nullability checks
|
|
||||||
JetExpression elseBranch = expression.getElse();
|
|
||||||
if (elseBranch == null) {
|
|
||||||
// TODO : type-check the branch
|
|
||||||
result[0] = JetStandardClasses.getUnitType();
|
|
||||||
} else {
|
|
||||||
JetType thenType = getType(scope, expression.getThen(), true);
|
|
||||||
JetType elseType = getType(scope, elseBranch, true);
|
|
||||||
result[0] = semanticServices.getTypeChecker().commonSupertype(Arrays.asList(thenType, elseType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitWhenExpression(JetWhenExpression expression) {
|
|
||||||
// TODO :change scope according to the bound value in the when header
|
|
||||||
List<JetType> expressions = new ArrayList<JetType>();
|
|
||||||
collectAllReturnTypes(expression, scope, expressions);
|
|
||||||
result[0] = semanticServices.getTypeChecker().commonSupertype(expressions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitTryExpression(JetTryExpression expression) {
|
|
||||||
JetExpression tryBlock = expression.getTryBlock();
|
|
||||||
List<JetCatchClause> catchClauses = expression.getCatchClauses();
|
|
||||||
JetFinallySection finallyBlock = expression.getFinallyBlock();
|
|
||||||
List<JetType> types = new ArrayList<JetType>();
|
|
||||||
if (finallyBlock == null) {
|
|
||||||
for (JetCatchClause catchClause : catchClauses) {
|
|
||||||
// TODO: change scope here
|
|
||||||
types.add(getType(scope, catchClause.getCatchBody(), true));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
types.add(getType(scope, finallyBlock.getFinalExpression(), true));
|
|
||||||
}
|
|
||||||
types.add(getType(scope, tryBlock, true));
|
|
||||||
result[0] = semanticServices.getTypeChecker().commonSupertype(types);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitTupleExpression(JetTupleExpression expression) {
|
|
||||||
List<JetExpression> entries = expression.getEntries();
|
|
||||||
List<JetType> types = new ArrayList<JetType>();
|
|
||||||
for (JetExpression entry : entries) {
|
|
||||||
types.add(getType(scope, entry, false));
|
|
||||||
}
|
|
||||||
// TODO : labels
|
|
||||||
result[0] = JetStandardClasses.getTupleType(types);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitThisExpression(JetThisExpression expression) {
|
|
||||||
// TODO : qualified this, e.g. Foo.this<Bar>
|
|
||||||
JetType thisType = scope.getThisType();
|
|
||||||
JetTypeReference superTypeQualifier = expression.getSuperTypeQualifier();
|
|
||||||
if (superTypeQualifier != null) {
|
|
||||||
// This cast must be safe (assuming the PSI doesn't contain errors)
|
|
||||||
JetUserType typeElement = (JetUserType) superTypeQualifier.getTypeElement();
|
|
||||||
ClassDescriptor superclass = typeResolver.resolveClass(scope, typeElement);
|
|
||||||
Collection<? extends JetType> supertypes = thisType.getConstructor().getSupertypes();
|
|
||||||
Map<TypeConstructor, TypeProjection> substitutionContext = TypeSubstitutor.INSTANCE.getSubstitutionContext(thisType);
|
|
||||||
for (JetType declaredSupertype : supertypes) {
|
|
||||||
if (declaredSupertype.getConstructor().equals(superclass.getTypeConstructor())) {
|
|
||||||
result[0] = TypeSubstitutor.INSTANCE.substitute(substitutionContext, declaredSupertype, Variance.INVARIANT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert result[0] != null;
|
|
||||||
} else {
|
|
||||||
result[0] = thisType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitBlockExpression(JetBlockExpression expression) {
|
|
||||||
result[0] = getBlockReturnedType(scope, expression.getStatements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitLoopExpression(JetLoopExpression expression) {
|
|
||||||
result[0] = JetStandardClasses.getUnitType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitNewExpression(JetNewExpression expression) {
|
|
||||||
// TODO : type argument inference
|
|
||||||
JetTypeReference typeReference = expression.getTypeReference();
|
|
||||||
result[0] = typeResolver.resolveType(scope, typeReference);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) {
|
|
||||||
// TODO : functions
|
|
||||||
JetExpression receiverExpression = expression.getReceiverExpression();
|
|
||||||
JetExpression selectorExpression = expression.getSelectorExpression();
|
|
||||||
JetType receiverType = getType(scope, receiverExpression, false);
|
|
||||||
if (receiverType != null) { // TODO : review
|
|
||||||
JetScope compositeScope = new ScopeWithReceiver(scope, receiverType);
|
|
||||||
result[0] = getType(compositeScope, selectorExpression, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitCallExpression(JetCallExpression expression) {
|
|
||||||
JetExpression calleeExpression = expression.getCalleeExpression();
|
|
||||||
|
|
||||||
// 1) ends with a name -> (scope, name) to look up
|
|
||||||
// 2) ends with something else -> just check types
|
|
||||||
|
|
||||||
// TODO : check somewhere that these are NOT projections
|
|
||||||
List<JetTypeProjection> typeArguments = expression.getTypeArguments();
|
|
||||||
|
|
||||||
List<JetArgument> valueArguments = expression.getValueArguments();
|
|
||||||
|
|
||||||
boolean someNamed = false;
|
|
||||||
for (JetArgument argument : valueArguments) {
|
|
||||||
if (argument.isNamed()) {
|
|
||||||
someNamed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<JetExpression> functionLiteralArguments = expression.getFunctionLiteralArguments();
|
|
||||||
|
|
||||||
// JetExpression functionLiteralArgument = functionLiteralArguments.isEmpty() ? null : functionLiteralArguments.get(0);
|
|
||||||
// TODO : must be a check
|
|
||||||
assert functionLiteralArguments.size() <= 1;
|
|
||||||
|
|
||||||
OverloadDomain overloadDomain = getOverloadDomain(scope, calleeExpression);
|
|
||||||
if (someNamed) {
|
|
||||||
// TODO : check that all are named
|
|
||||||
throw new UnsupportedOperationException(); // TODO
|
|
||||||
|
|
||||||
// result[0] = overloadDomain.getFunctionDescriptorForNamedArguments(typeArguments, valueArguments, functionLiteralArgument);
|
|
||||||
} else {
|
|
||||||
List<JetType> types = new ArrayList<JetType>();
|
|
||||||
for (JetTypeProjection projection : typeArguments) {
|
|
||||||
// TODO : check that there's no projection
|
|
||||||
types.add(typeResolver.resolveType(scope, projection.getTypeReference()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<JetExpression> positionedValueArguments = new ArrayList<JetExpression>();
|
|
||||||
for (JetArgument argument : valueArguments) {
|
|
||||||
positionedValueArguments.add(argument.getArgumentExpression());
|
|
||||||
}
|
|
||||||
|
|
||||||
positionedValueArguments.addAll(functionLiteralArguments);
|
|
||||||
|
|
||||||
List<JetType> valueArgumentTypes = new ArrayList<JetType>();
|
|
||||||
for (JetExpression valueArgument : positionedValueArguments) {
|
|
||||||
valueArgumentTypes.add(getType(scope, valueArgument, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
FunctionDescriptor functionDescriptor = overloadDomain.getFunctionDescriptorForPositionedArguments(types, valueArgumentTypes);
|
|
||||||
if (functionDescriptor != null) {
|
|
||||||
result[0] = functionDescriptor.getUnsubstitutedReturnType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitBinaryExpression(JetBinaryExpression expression) {
|
|
||||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
|
||||||
|
|
||||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
|
||||||
if (operationType == JetTokens.IDENTIFIER) {
|
|
||||||
result[0] = getTypeForBinaryCall(expression, operationSign.getReferencedName(), scope);
|
|
||||||
}
|
|
||||||
else if (operationType == JetTokens.PLUS) {
|
|
||||||
result[0] = getTypeForBinaryCall(expression, "plus", scope);
|
|
||||||
}
|
|
||||||
else if (operationType == JetTokens.EQ) {
|
|
||||||
JetExpression left = expression.getLeft();
|
|
||||||
JetExpression deparenthesized = deparenthesize(left);
|
|
||||||
if (deparenthesized instanceof JetArrayAccessExpression) {
|
|
||||||
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized;
|
|
||||||
resolveArrayAccessToLValue(arrayAccessExpression, expression.getRight(), expression.getOperationReference());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
getType(scope, expression.getRight(), false);
|
|
||||||
//throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
result[0] = null; // TODO : This is not an expression, in fact!
|
|
||||||
} else {
|
|
||||||
throw new UnsupportedOperationException(); // TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
|
||||||
JetExpression arrayExpression = expression.getArrayExpression();
|
|
||||||
JetType receiverType = getType(scope, arrayExpression, false);
|
|
||||||
List<JetExpression> indexExpressions = expression.getIndexExpressions();
|
|
||||||
List<JetType> argumentTypes = getTypes(scope, indexExpressions);
|
|
||||||
if (argumentTypes == null) return;
|
|
||||||
|
|
||||||
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression, "get", receiverType, argumentTypes);
|
|
||||||
if (functionDescriptor != null) {
|
|
||||||
result[0] = functionDescriptor.getUnsubstitutedReturnType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resolveArrayAccessToLValue(JetArrayAccessExpression arrayAccessExpression, JetExpression rightHandSide, JetSimpleNameExpression operationSign) {
|
|
||||||
List<JetType> argumentTypes = getTypes(scope, arrayAccessExpression.getIndexExpressions());
|
|
||||||
if (argumentTypes == null) return;
|
|
||||||
JetType rhsType = getType(scope, rightHandSide, false);
|
|
||||||
if (rhsType == null) return;
|
|
||||||
argumentTypes.add(rhsType);
|
|
||||||
|
|
||||||
JetType receiverType = getType(scope, arrayAccessExpression.getArrayExpression(), false);
|
|
||||||
if (receiverType == null) return;
|
|
||||||
|
|
||||||
// TODO : nasty hack: effort is duplicated
|
|
||||||
lookupFunction(scope, arrayAccessExpression, "set", receiverType, argumentTypes);
|
|
||||||
FunctionDescriptor functionDescriptor = lookupFunction(scope, operationSign, "set", receiverType, argumentTypes);
|
|
||||||
if (functionDescriptor != null) {
|
|
||||||
result[0] = functionDescriptor.getUnsubstitutedReturnType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitJetElement(JetElement elem) {
|
|
||||||
throw new IllegalArgumentException("Unsupported element: " + elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JetType getTypeForBinaryCall(JetBinaryExpression expression, String name, JetScope scope) {
|
|
||||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
|
||||||
JetExpression left = expression.getLeft();
|
|
||||||
JetType leftType = getType(scope, left, false);
|
|
||||||
JetExpression right = expression.getRight();
|
|
||||||
if (right == null) {
|
|
||||||
return ErrorType.createErrorType("No right argument");
|
|
||||||
}
|
|
||||||
JetType rightType = getType(scope, right, false);
|
|
||||||
FunctionDescriptor functionDescriptor = lookupFunction(scope, operationSign, name, leftType, Collections.singletonList(rightType));
|
|
||||||
if (functionDescriptor != null) {
|
|
||||||
return functionDescriptor.getUnsubstitutedReturnType();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (result[0] != null) {
|
|
||||||
trace.recordExpressionType(expression, result[0]);
|
|
||||||
}
|
}
|
||||||
return result[0];
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -590,4 +204,472 @@ public class JetTypeInferrer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TypeInferrerVisitor extends JetVisitor {
|
||||||
|
private final JetScope scope;
|
||||||
|
private JetType result;
|
||||||
|
private final boolean preferBlock;
|
||||||
|
|
||||||
|
public TypeInferrerVisitor(JetScope scope, boolean preferBlock) {
|
||||||
|
this.scope = scope;
|
||||||
|
this.preferBlock = preferBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetType getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitReferenceExpression(JetSimpleNameExpression expression) {
|
||||||
|
// TODO : other members
|
||||||
|
// TODO : type substitutions???
|
||||||
|
String referencedName = expression.getReferencedName();
|
||||||
|
PropertyDescriptor property = scope.getProperty(referencedName);
|
||||||
|
if (property != null) {
|
||||||
|
trace.recordReferenceResolution(expression, property);
|
||||||
|
result = property.getType();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
NamespaceDescriptor namespace = scope.getNamespace(referencedName);
|
||||||
|
if (namespace != null) {
|
||||||
|
trace.recordReferenceResolution(expression, namespace);
|
||||||
|
result = namespace.getNamespaceType();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
semanticServices.getErrorHandler().unresolvedReference(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||||
|
if (preferBlock && !expression.hasParameterSpecification()) {
|
||||||
|
result = getBlockReturnedType(scope, expression.getBody());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(scope.getContainingDeclaration(), Collections.<Attribute>emptyList(), "<anonymous>");
|
||||||
|
|
||||||
|
JetTypeReference returnTypeRef = expression.getReturnTypeRef();
|
||||||
|
|
||||||
|
JetTypeReference receiverTypeRef = expression.getReceiverTypeRef();
|
||||||
|
final JetType receiverType;
|
||||||
|
if (receiverTypeRef != null) {
|
||||||
|
receiverType = typeResolver.resolveType(scope, receiverTypeRef);
|
||||||
|
} else {
|
||||||
|
receiverType = scope.getThisType();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<JetElement> body = expression.getBody();
|
||||||
|
final Map<String, PropertyDescriptor> parameterDescriptors = new HashMap<String, PropertyDescriptor>();
|
||||||
|
List<JetType> parameterTypes = new ArrayList<JetType>();
|
||||||
|
for (JetParameter parameter : expression.getParameters()) {
|
||||||
|
JetTypeReference typeReference = parameter.getTypeReference();
|
||||||
|
if (typeReference == null) {
|
||||||
|
throw new UnsupportedOperationException("Type inference for parameters is not implemented yet");
|
||||||
|
}
|
||||||
|
PropertyDescriptor propertyDescriptor = classDescriptorResolver.resolvePropertyDescriptor(functionDescriptor, scope, parameter);
|
||||||
|
parameterDescriptors.put(parameter.getName(), propertyDescriptor);
|
||||||
|
parameterTypes.add(propertyDescriptor.getType());
|
||||||
|
}
|
||||||
|
JetType returnType;
|
||||||
|
if (returnTypeRef != null) {
|
||||||
|
returnType = typeResolver.resolveType(scope, returnTypeRef);
|
||||||
|
} else {
|
||||||
|
WritableScope writableScope = new WritableScope(scope, functionDescriptor);
|
||||||
|
for (PropertyDescriptor propertyDescriptor : parameterDescriptors.values()) {
|
||||||
|
writableScope.addPropertyDescriptor(propertyDescriptor);
|
||||||
|
}
|
||||||
|
writableScope.setThisType(receiverType);
|
||||||
|
returnType = getBlockReturnedType(writableScope, body);
|
||||||
|
}
|
||||||
|
result = JetStandardClasses.getFunctionType(null, receiverTypeRef == null ? null : receiverType, parameterTypes, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||||
|
result = getType(scope, expression.getExpression(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitConstantExpression(JetConstantExpression expression) {
|
||||||
|
IElementType elementType = expression.getNode().getElementType();
|
||||||
|
JetStandardLibrary standardLibrary = semanticServices.getStandardLibrary();
|
||||||
|
if (elementType == JetNodeTypes.INTEGER_CONSTANT) {
|
||||||
|
result = standardLibrary.getIntType();
|
||||||
|
} else if (elementType == JetNodeTypes.LONG_CONSTANT) {
|
||||||
|
result = standardLibrary.getLongType();
|
||||||
|
} else if (elementType == JetNodeTypes.FLOAT_CONSTANT) {
|
||||||
|
String text = expression.getText();
|
||||||
|
assert text.length() > 0;
|
||||||
|
char lastChar = text.charAt(text.length() - 1);
|
||||||
|
if (lastChar == 'f' || lastChar == 'F') {
|
||||||
|
result = standardLibrary.getFloatType();
|
||||||
|
} else {
|
||||||
|
result = standardLibrary.getDoubleType();
|
||||||
|
}
|
||||||
|
} else if (elementType == JetNodeTypes.BOOLEAN_CONSTANT) {
|
||||||
|
result = standardLibrary.getBooleanType();
|
||||||
|
} else if (elementType == JetNodeTypes.CHARACTER_CONSTANT) {
|
||||||
|
result = standardLibrary.getCharType();
|
||||||
|
} else if (elementType == JetNodeTypes.STRING_CONSTANT) {
|
||||||
|
result = standardLibrary.getStringType();
|
||||||
|
} else if (elementType == JetNodeTypes.NULL) {
|
||||||
|
result = JetStandardClasses.getNullableNothingType();
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Unsupported constant: " + expression);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitThrowExpression(JetThrowExpression expression) {
|
||||||
|
result = JetStandardClasses.getNothingType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitReturnExpression(JetReturnExpression expression) {
|
||||||
|
JetExpression returnedExpression = expression.getReturnedExpression();
|
||||||
|
if (returnedExpression != null) {
|
||||||
|
getType(scope, returnedExpression, false);
|
||||||
|
}
|
||||||
|
result = JetStandardClasses.getNothingType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBreakExpression(JetBreakExpression expression) {
|
||||||
|
result = JetStandardClasses.getNothingType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitContinueExpression(JetContinueExpression expression) {
|
||||||
|
result = JetStandardClasses.getNothingType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitTypeofExpression(JetTypeofExpression expression) {
|
||||||
|
throw new UnsupportedOperationException("Return some reflection interface"); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
||||||
|
if (expression.getOperationReference().getReferencedNameElementType() == JetTokens.COLON) {
|
||||||
|
JetType actualType = getType(scope, expression.getLeft(), false);
|
||||||
|
JetType expectedType = typeResolver.resolveType(scope, expression.getRight());
|
||||||
|
if (actualType != null && !semanticServices.getTypeChecker().isSubtypeOf(actualType, expectedType)) {
|
||||||
|
// TODO
|
||||||
|
semanticServices.getErrorHandler().typeMismatch(expression.getLeft(), expectedType, actualType);
|
||||||
|
}
|
||||||
|
result = expectedType;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new UnsupportedOperationException(); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitIfExpression(JetIfExpression expression) {
|
||||||
|
// TODO : check condition type
|
||||||
|
// TODO : change types according to is and nullability checks
|
||||||
|
JetExpression elseBranch = expression.getElse();
|
||||||
|
if (elseBranch == null) {
|
||||||
|
// TODO : type-check the branch
|
||||||
|
result = JetStandardClasses.getUnitType();
|
||||||
|
} else {
|
||||||
|
JetType thenType = getType(scope, expression.getThen(), true);
|
||||||
|
JetType elseType = getType(scope, elseBranch, true);
|
||||||
|
result = semanticServices.getTypeChecker().commonSupertype(Arrays.asList(thenType, elseType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitWhenExpression(JetWhenExpression expression) {
|
||||||
|
// TODO :change scope according to the bound value in the when header
|
||||||
|
List<JetType> expressions = new ArrayList<JetType>();
|
||||||
|
collectAllReturnTypes(expression, scope, expressions);
|
||||||
|
result = semanticServices.getTypeChecker().commonSupertype(expressions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitTryExpression(JetTryExpression expression) {
|
||||||
|
JetExpression tryBlock = expression.getTryBlock();
|
||||||
|
List<JetCatchClause> catchClauses = expression.getCatchClauses();
|
||||||
|
JetFinallySection finallyBlock = expression.getFinallyBlock();
|
||||||
|
List<JetType> types = new ArrayList<JetType>();
|
||||||
|
if (finallyBlock == null) {
|
||||||
|
for (JetCatchClause catchClause : catchClauses) {
|
||||||
|
// TODO: change scope here
|
||||||
|
types.add(getType(scope, catchClause.getCatchBody(), true));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
types.add(getType(scope, finallyBlock.getFinalExpression(), true));
|
||||||
|
}
|
||||||
|
types.add(getType(scope, tryBlock, true));
|
||||||
|
result = semanticServices.getTypeChecker().commonSupertype(types);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitTupleExpression(JetTupleExpression expression) {
|
||||||
|
List<JetExpression> entries = expression.getEntries();
|
||||||
|
List<JetType> types = new ArrayList<JetType>();
|
||||||
|
for (JetExpression entry : entries) {
|
||||||
|
types.add(getType(scope, entry, false));
|
||||||
|
}
|
||||||
|
// TODO : labels
|
||||||
|
result = JetStandardClasses.getTupleType(types);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitThisExpression(JetThisExpression expression) {
|
||||||
|
// TODO : qualified this, e.g. Foo.this<Bar>
|
||||||
|
JetType thisType = scope.getThisType();
|
||||||
|
JetTypeReference superTypeQualifier = expression.getSuperTypeQualifier();
|
||||||
|
if (superTypeQualifier != null) {
|
||||||
|
// This cast must be safe (assuming the PSI doesn't contain errors)
|
||||||
|
JetUserType typeElement = (JetUserType) superTypeQualifier.getTypeElement();
|
||||||
|
ClassDescriptor superclass = typeResolver.resolveClass(scope, typeElement);
|
||||||
|
Collection<? extends JetType> supertypes = thisType.getConstructor().getSupertypes();
|
||||||
|
Map<TypeConstructor, TypeProjection> substitutionContext = TypeSubstitutor.INSTANCE.getSubstitutionContext(thisType);
|
||||||
|
for (JetType declaredSupertype : supertypes) {
|
||||||
|
if (declaredSupertype.getConstructor().equals(superclass.getTypeConstructor())) {
|
||||||
|
result = TypeSubstitutor.INSTANCE.substitute(substitutionContext, declaredSupertype, Variance.INVARIANT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert result != null;
|
||||||
|
} else {
|
||||||
|
result = thisType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBlockExpression(JetBlockExpression expression) {
|
||||||
|
result = getBlockReturnedType(scope, expression.getStatements());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitLoopExpression(JetLoopExpression expression) {
|
||||||
|
result = JetStandardClasses.getUnitType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitNewExpression(JetNewExpression expression) {
|
||||||
|
// TODO : type argument inference
|
||||||
|
JetTypeReference typeReference = expression.getTypeReference();
|
||||||
|
result = typeResolver.resolveType(scope, typeReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) {
|
||||||
|
// TODO : functions
|
||||||
|
JetExpression receiverExpression = expression.getReceiverExpression();
|
||||||
|
JetExpression selectorExpression = expression.getSelectorExpression();
|
||||||
|
JetType receiverType = getType(scope, receiverExpression, false);
|
||||||
|
if (receiverType != null) { // TODO : review
|
||||||
|
JetScope compositeScope = new ScopeWithReceiver(scope, receiverType);
|
||||||
|
result = getType(compositeScope, selectorExpression, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitCallExpression(JetCallExpression expression) {
|
||||||
|
JetExpression calleeExpression = expression.getCalleeExpression();
|
||||||
|
|
||||||
|
// 1) ends with a name -> (scope, name) to look up
|
||||||
|
// 2) ends with something else -> just check types
|
||||||
|
|
||||||
|
// TODO : check somewhere that these are NOT projections
|
||||||
|
List<JetTypeProjection> typeArguments = expression.getTypeArguments();
|
||||||
|
|
||||||
|
List<JetArgument> valueArguments = expression.getValueArguments();
|
||||||
|
|
||||||
|
boolean someNamed = false;
|
||||||
|
for (JetArgument argument : valueArguments) {
|
||||||
|
if (argument.isNamed()) {
|
||||||
|
someNamed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<JetExpression> functionLiteralArguments = expression.getFunctionLiteralArguments();
|
||||||
|
|
||||||
|
// JetExpression functionLiteralArgument = functionLiteralArguments.isEmpty() ? null : functionLiteralArguments.get(0);
|
||||||
|
// TODO : must be a check
|
||||||
|
assert functionLiteralArguments.size() <= 1;
|
||||||
|
|
||||||
|
OverloadDomain overloadDomain = getOverloadDomain(scope, calleeExpression);
|
||||||
|
if (someNamed) {
|
||||||
|
// TODO : check that all are named
|
||||||
|
throw new UnsupportedOperationException(); // TODO
|
||||||
|
|
||||||
|
// result = overloadDomain.getFunctionDescriptorForNamedArguments(typeArguments, valueArguments, functionLiteralArgument);
|
||||||
|
} else {
|
||||||
|
List<JetType> types = new ArrayList<JetType>();
|
||||||
|
for (JetTypeProjection projection : typeArguments) {
|
||||||
|
// TODO : check that there's no projection
|
||||||
|
types.add(typeResolver.resolveType(scope, projection.getTypeReference()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<JetExpression> positionedValueArguments = new ArrayList<JetExpression>();
|
||||||
|
for (JetArgument argument : valueArguments) {
|
||||||
|
positionedValueArguments.add(argument.getArgumentExpression());
|
||||||
|
}
|
||||||
|
|
||||||
|
positionedValueArguments.addAll(functionLiteralArguments);
|
||||||
|
|
||||||
|
List<JetType> valueArgumentTypes = new ArrayList<JetType>();
|
||||||
|
for (JetExpression valueArgument : positionedValueArguments) {
|
||||||
|
valueArgumentTypes.add(getType(scope, valueArgument, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
FunctionDescriptor functionDescriptor = overloadDomain.getFunctionDescriptorForPositionedArguments(types, valueArgumentTypes);
|
||||||
|
if (functionDescriptor != null) {
|
||||||
|
result = functionDescriptor.getUnsubstitutedReturnType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||||
|
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||||
|
if (operationSign.getReferencedNameElementType() == JetTokens.EXCL) {
|
||||||
|
JetExpression baseExpression = expression.getBaseExpression();
|
||||||
|
JetType type = getType(scope, baseExpression, false);
|
||||||
|
if (type != null) {
|
||||||
|
FunctionDescriptor functionDescriptor = lookupFunction(scope, operationSign, "not", type, Collections.<JetType>emptyList());
|
||||||
|
if (functionDescriptor != null) {
|
||||||
|
result = functionDescriptor.getUnsubstitutedReturnType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new UnsupportedOperationException(); // TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitBinaryExpression(JetBinaryExpression expression) {
|
||||||
|
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||||
|
|
||||||
|
IElementType operationType = operationSign.getReferencedNameElementType();
|
||||||
|
if (operationType == JetTokens.IDENTIFIER) {
|
||||||
|
result = getTypeForBinaryCall(expression, operationSign.getReferencedName(), scope);
|
||||||
|
}
|
||||||
|
else if (operationType == JetTokens.PLUS) {
|
||||||
|
result = getTypeForBinaryCall(expression, "plus", scope);
|
||||||
|
}
|
||||||
|
else if (operationType == JetTokens.EQ) {
|
||||||
|
JetExpression left = expression.getLeft();
|
||||||
|
JetExpression deparenthesized = deparenthesize(left);
|
||||||
|
if (deparenthesized instanceof JetArrayAccessExpression) {
|
||||||
|
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized;
|
||||||
|
resolveArrayAccessToLValue(arrayAccessExpression, expression.getRight(), expression.getOperationReference());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getType(scope, expression.getRight(), false);
|
||||||
|
//throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
result = null; // TODO : This is not an expression, in fact!
|
||||||
|
}
|
||||||
|
else if (operationType == JetTokens.LT) {
|
||||||
|
JetExpression left = expression.getLeft();
|
||||||
|
JetExpression deparenthesized = deparenthesize(left);
|
||||||
|
if (deparenthesized instanceof JetArrayAccessExpression) {
|
||||||
|
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized;
|
||||||
|
resolveArrayAccessToLValue(arrayAccessExpression, expression.getRight(), expression.getOperationReference());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getType(scope, expression.getRight(), false);
|
||||||
|
//throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
result = null; // TODO : This is not an expression, in fact!
|
||||||
|
} else {
|
||||||
|
throw new UnsupportedOperationException(); // TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
||||||
|
JetExpression arrayExpression = expression.getArrayExpression();
|
||||||
|
JetType receiverType = getType(scope, arrayExpression, false);
|
||||||
|
List<JetExpression> indexExpressions = expression.getIndexExpressions();
|
||||||
|
List<JetType> argumentTypes = getTypes(scope, indexExpressions);
|
||||||
|
if (argumentTypes == null) return;
|
||||||
|
|
||||||
|
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression, "get", receiverType, argumentTypes);
|
||||||
|
if (functionDescriptor != null) {
|
||||||
|
result = functionDescriptor.getUnsubstitutedReturnType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resolveArrayAccessToLValue(JetArrayAccessExpression arrayAccessExpression, JetExpression rightHandSide, JetSimpleNameExpression operationSign) {
|
||||||
|
List<JetType> argumentTypes = getTypes(scope, arrayAccessExpression.getIndexExpressions());
|
||||||
|
if (argumentTypes == null) return;
|
||||||
|
JetType rhsType = getType(scope, rightHandSide, false);
|
||||||
|
if (rhsType == null) return;
|
||||||
|
argumentTypes.add(rhsType);
|
||||||
|
|
||||||
|
JetType receiverType = getType(scope, arrayAccessExpression.getArrayExpression(), false);
|
||||||
|
if (receiverType == null) return;
|
||||||
|
|
||||||
|
// TODO : nasty hack: effort is duplicated
|
||||||
|
lookupFunction(scope, arrayAccessExpression, "set", receiverType, argumentTypes);
|
||||||
|
FunctionDescriptor functionDescriptor = lookupFunction(scope, operationSign, "set", receiverType, argumentTypes);
|
||||||
|
if (functionDescriptor != null) {
|
||||||
|
result = functionDescriptor.getUnsubstitutedReturnType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitJetElement(JetElement elem) {
|
||||||
|
throw new IllegalArgumentException("Unsupported element: " + elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JetType getTypeForBinaryCall(JetBinaryExpression expression, String name, JetScope scope) {
|
||||||
|
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||||
|
JetExpression left = expression.getLeft();
|
||||||
|
JetType leftType = getType(scope, left, false);
|
||||||
|
JetExpression right = expression.getRight();
|
||||||
|
if (right == null) {
|
||||||
|
return ErrorType.createErrorType("No right argument"); // TODO
|
||||||
|
}
|
||||||
|
JetType rightType = getType(scope, right, false);
|
||||||
|
FunctionDescriptor functionDescriptor = lookupFunction(scope, operationSign, name, leftType, Collections.singletonList(rightType));
|
||||||
|
if (functionDescriptor != null) {
|
||||||
|
return functionDescriptor.getUnsubstitutedReturnType();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Map<IElementType, String> operationToMethodName = new HashMap<IElementType, String>();
|
||||||
|
|
||||||
|
// operationToMethodName.put(JetTokens.EXCL, "excl");
|
||||||
|
//
|
||||||
|
// operationToMethodName.put(JetTokens.LT, "lt");
|
||||||
|
// operationToMethodName.put(JetTokens.GT, "gt");
|
||||||
|
// operationToMethodName.put(JetTokens.LTEQ, "lteq");
|
||||||
|
// operationToMethodName.put(JetTokens.GTEQ, "gteq");
|
||||||
|
//
|
||||||
|
// operationToMethodName.put(JetTokens.EQEQ, "eqeq");
|
||||||
|
// operationToMethodName.put(JetTokens.EXCLEQ, "excleq");
|
||||||
|
//
|
||||||
|
// operationToMethodName.put(JetTokens.MULTEQ, "multeq");
|
||||||
|
// operationToMethodName.put(JetTokens.DIVEQ, "diveq");
|
||||||
|
// operationToMethodName.put(JetTokens.PERCEQ, "perceq");
|
||||||
|
// operationToMethodName.put(JetTokens.PLUSEQ, "pluseq");
|
||||||
|
// operationToMethodName.put(JetTokens.MINUSEQ, "minuseq");
|
||||||
|
//
|
||||||
|
// operationToMethodName.put(JetTokens.PLUSPLUS, "plusplus");
|
||||||
|
// operationToMethodName.put(JetTokens.MINUSMINUS, "minusminus");
|
||||||
|
|
||||||
|
operationToMethodName.put(JetTokens.MUL, "times");
|
||||||
|
operationToMethodName.put(JetTokens.PLUS, "plus");
|
||||||
|
operationToMethodName.put(JetTokens.MINUS, "minus");
|
||||||
|
operationToMethodName.put(JetTokens.DIV, "div");
|
||||||
|
operationToMethodName.put(JetTokens.PERC, "mod");
|
||||||
|
operationToMethodName.put(JetTokens.ARROW, "arrow");
|
||||||
|
operationToMethodName.put(JetTokens.RANGE, "rangeTo");
|
||||||
|
|
||||||
|
// operationToMethodName.put(JetTokens.IN_KEYWORD, "contains");
|
||||||
|
// operationToMethodName.put(JetTokens.NOT_IN, "not_in");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,58 +3,21 @@ package org.jetbrains.jet.lang.types;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author abreslav
|
* @author abreslav
|
||||||
*/
|
*/
|
||||||
public class TypeConstructor extends AnnotatedImpl {
|
public interface TypeConstructor extends Annotated {
|
||||||
private final List<TypeParameterDescriptor> parameters;
|
@NotNull
|
||||||
private final Collection<? extends JetType> supertypes;
|
List<TypeParameterDescriptor> getParameters();
|
||||||
private final String debugName;
|
|
||||||
private final boolean sealed;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private final DeclarationDescriptor declarationDescriptor;
|
|
||||||
|
|
||||||
public TypeConstructor(
|
|
||||||
@Nullable DeclarationDescriptor declarationDescriptor,
|
|
||||||
@NotNull List<Attribute> attributes,
|
|
||||||
boolean sealed,
|
|
||||||
@NotNull String debugName,
|
|
||||||
@NotNull List<TypeParameterDescriptor> parameters,
|
|
||||||
@NotNull Collection<? extends JetType> supertypes) {
|
|
||||||
super(attributes);
|
|
||||||
this.declarationDescriptor = declarationDescriptor;
|
|
||||||
this.sealed = sealed;
|
|
||||||
this.debugName = debugName;
|
|
||||||
this.parameters = new ArrayList<TypeParameterDescriptor>(parameters);
|
|
||||||
this.supertypes = supertypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<TypeParameterDescriptor> getParameters() {
|
Collection<? extends JetType> getSupertypes();
|
||||||
return parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
boolean isSealed();
|
||||||
public Collection<? extends JetType> getSupertypes() {
|
|
||||||
return supertypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return debugName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSealed() {
|
|
||||||
return sealed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public DeclarationDescriptor getDeclarationDescriptor() {
|
DeclarationDescriptor getDeclarationDescriptor();
|
||||||
return declarationDescriptor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author abreslav
|
||||||
|
*/
|
||||||
|
public class TypeConstructorImpl extends AnnotatedImpl implements TypeConstructor {
|
||||||
|
private final List<TypeParameterDescriptor> parameters;
|
||||||
|
private Collection<? extends JetType> supertypes;
|
||||||
|
private final String debugName;
|
||||||
|
private final boolean sealed;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final DeclarationDescriptor declarationDescriptor;
|
||||||
|
|
||||||
|
public TypeConstructorImpl(
|
||||||
|
@Nullable DeclarationDescriptor declarationDescriptor,
|
||||||
|
@NotNull List<Attribute> attributes,
|
||||||
|
boolean sealed,
|
||||||
|
@NotNull String debugName,
|
||||||
|
@NotNull List<TypeParameterDescriptor> parameters,
|
||||||
|
@NotNull Collection<? extends JetType> supertypes) {
|
||||||
|
super(attributes);
|
||||||
|
this.declarationDescriptor = declarationDescriptor;
|
||||||
|
this.sealed = sealed;
|
||||||
|
this.debugName = debugName;
|
||||||
|
this.parameters = new ArrayList<TypeParameterDescriptor>(parameters);
|
||||||
|
this.supertypes = supertypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
public List<TypeParameterDescriptor> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
public Collection<? extends JetType> getSupertypes() {
|
||||||
|
return supertypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return debugName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSealed() {
|
||||||
|
return sealed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public DeclarationDescriptor getDeclarationDescriptor() {
|
||||||
|
return declarationDescriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl {
|
|||||||
this.variance = variance;
|
this.variance = variance;
|
||||||
this.upperBounds = upperBounds;
|
this.upperBounds = upperBounds;
|
||||||
// TODO: Should we actually pass the attributes on to the type constructor?
|
// TODO: Should we actually pass the attributes on to the type constructor?
|
||||||
this.typeConstructor = new TypeConstructor(
|
this.typeConstructor = new TypeConstructorImpl(
|
||||||
this,
|
this,
|
||||||
attributes,
|
attributes,
|
||||||
false,
|
false,
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class TypeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Attribute> noAttributes = Collections.<Attribute>emptyList();
|
List<Attribute> noAttributes = Collections.<Attribute>emptyList();
|
||||||
TypeConstructor constructor = new TypeConstructor(null, noAttributes, false, debugName.toString(), Collections.<TypeParameterDescriptor>emptyList(), types);
|
TypeConstructor constructor = new TypeConstructorImpl(null, noAttributes, false, debugName.toString(), Collections.<TypeParameterDescriptor>emptyList(), types);
|
||||||
return new JetTypeImpl(
|
return new JetTypeImpl(
|
||||||
noAttributes,
|
noAttributes,
|
||||||
constructor,
|
constructor,
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ JetFile: CallsInWhen.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
BODY
|
BODY
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('bar')
|
PsiElement(IDENTIFIER)('bar')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -171,7 +172,8 @@ JetFile: CallsInWhen.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
BODY
|
BODY
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('bar')
|
PsiElement(IDENTIFIER)('bar')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ JetFile: ControlStructures.jet
|
|||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BREAK
|
BREAK
|
||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
@@ -209,7 +210,8 @@ JetFile: ControlStructures.jet
|
|||||||
PsiElement(continue)('continue')
|
PsiElement(continue)('continue')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
CONTINUE
|
CONTINUE
|
||||||
PsiElement(continue)('continue')
|
PsiElement(continue)('continue')
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -27,7 +28,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiComment(DOC_COMMENT)('/** */')
|
PsiComment(DOC_COMMENT)('/** */')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -37,7 +39,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiComment(BLOCK_COMMENT)('/* */')
|
PsiComment(BLOCK_COMMENT)('/* */')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -60,7 +63,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiComment(BLOCK_COMMENT)('/*\n */')
|
PsiComment(BLOCK_COMMENT)('/*\n */')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -83,7 +87,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiComment(EOL_COMMENT)('//')
|
PsiComment(EOL_COMMENT)('//')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -94,7 +99,8 @@ JetFile: EOLsInComments.jet
|
|||||||
PsiComment(EOL_COMMENT)('//')
|
PsiComment(EOL_COMMENT)('//')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ JetFile: Labels.jet
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
@@ -52,18 +53,20 @@ JetFile: Labels.jet
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
RETURN
|
||||||
|
PsiElement(return)('return')
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PREFIX_EXPRESSION
|
||||||
|
OPERATION_REFERENCE
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
INTEGER_CONSTANT
|
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
RETURN
|
|
||||||
PsiElement(return)('return')
|
|
||||||
PsiElement(AT)('@')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PREFIX_EXPRESSION
|
|
||||||
PsiElement(AT)('@')
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
@@ -86,18 +89,20 @@ JetFile: Labels.jet
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
RETURN
|
||||||
|
PsiElement(return)('return')
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PREFIX_EXPRESSION
|
||||||
|
OPERATION_REFERENCE
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
INTEGER_CONSTANT
|
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
RETURN
|
|
||||||
PsiElement(return)('return')
|
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PREFIX_EXPRESSION
|
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
@@ -120,7 +125,8 @@ JetFile: Labels.jet
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(ATAT)('@@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
@@ -131,20 +137,23 @@ JetFile: Labels.jet
|
|||||||
PsiElement(ATAT)('@@')
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(ATAT)('@@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiElement(ATAT)('@@')
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
@@ -154,7 +163,8 @@ JetFile: Labels.jet
|
|||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
@@ -163,21 +173,24 @@ JetFile: Labels.jet
|
|||||||
PARENTHESIZED
|
PARENTHESIZED
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(ATAT)('@@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@a')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
PsiElement(ATAT)('@@')
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(ATAT)('@@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(ATAT)('@@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
@@ -221,7 +234,8 @@ JetFile: Labels.jet
|
|||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@f')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@f')
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
@@ -257,7 +271,8 @@ JetFile: Labels.jet
|
|||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(AT)('@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(AT)('@')
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
@@ -293,7 +308,8 @@ JetFile: Labels.jet
|
|||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(ATAT)('@@')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(ATAT)('@@')
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -99,7 +100,8 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -123,7 +125,8 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
@@ -178,7 +181,8 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiElement(IDENTIFIER)('c')
|
PsiElement(IDENTIFIER)('c')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('d')
|
PsiElement(IDENTIFIER)('d')
|
||||||
@@ -205,7 +209,8 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiElement(IDENTIFIER)('c')
|
PsiElement(IDENTIFIER)('c')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUS)('+')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('d')
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ JetFile: Precedence.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('x')
|
PsiElement(IDENTIFIER)('x')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -36,13 +37,16 @@ JetFile: Precedence.jet
|
|||||||
PsiElement(INTEGER_LITERAL)('4')
|
PsiElement(INTEGER_LITERAL)('4')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUSMINUS)('--')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUSMINUS)('--')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
@@ -433,10 +437,12 @@ JetFile: Precedence.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUSMINUS)('--')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUSMINUS)('--')
|
||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -444,11 +450,13 @@ JetFile: Precedence.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUSMINUS)('--')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUSMINUS)('--')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -940,7 +948,8 @@ JetFile: Precedence.jet
|
|||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
BINARY_WITH_TYPE
|
BINARY_WITH_TYPE
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('t')
|
PsiElement(IDENTIFIER)('t')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
|||||||
@@ -671,7 +671,8 @@ JetFile: SimpleExpressions.jet
|
|||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BREAK
|
BREAK
|
||||||
PsiElement(break)('break')
|
PsiElement(break)('break')
|
||||||
@@ -682,7 +683,8 @@ JetFile: SimpleExpressions.jet
|
|||||||
PsiElement(continue)('continue')
|
PsiElement(continue)('continue')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
CONTINUE
|
CONTINUE
|
||||||
PsiElement(continue)('continue')
|
PsiElement(continue)('continue')
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ JetFile: AnonymousObjects.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('clickCount')
|
PsiElement(IDENTIFIER)('clickCount')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiElement(SEMICOLON)(';')
|
PsiElement(SEMICOLON)(';')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
IF
|
IF
|
||||||
|
|||||||
@@ -564,12 +564,14 @@ JetFile: BinaryTree.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('size')
|
PsiElement(IDENTIFIER)('size')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('version')
|
PsiElement(IDENTIFIER)('version')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
@@ -1168,12 +1170,14 @@ JetFile: BinaryTree.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('size')
|
PsiElement(IDENTIFIER)('size')
|
||||||
PsiElement(MINUSMINUS)('--')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUSMINUS)('--')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('version')
|
PsiElement(IDENTIFIER)('version')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
@@ -2048,7 +2052,8 @@ JetFile: BinaryTree.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('hasNext')
|
PsiElement(IDENTIFIER)('hasNext')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
@@ -2140,7 +2145,8 @@ JetFile: BinaryTree.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('down')
|
PsiElement(IDENTIFIER)('down')
|
||||||
@@ -2400,7 +2406,8 @@ JetFile: BinaryTree.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('down')
|
PsiElement(IDENTIFIER)('down')
|
||||||
@@ -2412,7 +2419,8 @@ JetFile: BinaryTree.jet
|
|||||||
PsiElement(OROR)('||')
|
PsiElement(OROR)('||')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('up')
|
PsiElement(IDENTIFIER)('up')
|
||||||
@@ -2486,7 +2494,8 @@ JetFile: BinaryTree.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('version')
|
PsiElement(IDENTIFIER)('version')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
|
|||||||
@@ -668,7 +668,8 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
CALL_EXPRESSION
|
CALL_EXPRESSION
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -852,7 +853,8 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
CALL_EXPRESSION
|
CALL_EXPRESSION
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -892,7 +894,8 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('pending')
|
PsiElement(IDENTIFIER)('pending')
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ JetFile: UpdateOperation.jet
|
|||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUS)('-')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUS)('-')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
|
|||||||
@@ -291,7 +291,8 @@ JetFile: ArrayList.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('index')
|
PsiElement(IDENTIFIER)('index')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -709,7 +710,8 @@ JetFile: ArrayList.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('used')
|
PsiElement(IDENTIFIER)('used')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
OPERATION_REFERENCE
|
OPERATION_REFERENCE
|
||||||
@@ -819,7 +821,8 @@ JetFile: ArrayList.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('used')
|
PsiElement(IDENTIFIER)('used')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
|||||||
@@ -354,7 +354,8 @@ JetFile: IIterator.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('hasNext')
|
PsiElement(IDENTIFIER)('hasNext')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
@@ -389,7 +390,8 @@ JetFile: IIterator.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('count')
|
PsiElement(IDENTIFIER)('count')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ JetFile: LinkedList.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('size')
|
PsiElement(IDENTIFIER)('size')
|
||||||
PsiElement(PLUSPLUS)('++')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUSPLUS)('++')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
CALL_EXPRESSION
|
CALL_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
@@ -682,7 +683,8 @@ JetFile: LinkedList.jet
|
|||||||
POSTFIX_EXPRESSION
|
POSTFIX_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('size')
|
PsiElement(IDENTIFIER)('size')
|
||||||
PsiElement(MINUSMINUS)('--')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUSMINUS)('--')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
|||||||
@@ -355,7 +355,8 @@ JetFile: IOSamples.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('nextUsed')
|
PsiElement(IDENTIFIER)('nextUsed')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
@@ -435,7 +436,8 @@ JetFile: IOSamples.jet
|
|||||||
PsiElement(EXCLEQ)('!=')
|
PsiElement(EXCLEQ)('!=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUS)('-')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUS)('-')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
@@ -488,7 +490,8 @@ JetFile: IOSamples.jet
|
|||||||
PsiElement(EXCLEQ)('!=')
|
PsiElement(EXCLEQ)('!=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(MINUS)('-')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(MINUS)('-')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
PsiWhiteSpace(' \n ')
|
PsiWhiteSpace(' \n ')
|
||||||
|
|||||||
@@ -784,7 +784,8 @@ JetFile: BinaryHeap.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
CONDITION
|
CONDITION
|
||||||
PREFIX_EXPRESSION
|
PREFIX_EXPRESSION
|
||||||
PsiElement(EXCL)('!')
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EXCL)('!')
|
||||||
DOT_QIALIFIED_EXPRESSION
|
DOT_QIALIFIED_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('current')
|
PsiElement(IDENTIFIER)('current')
|
||||||
|
|||||||
@@ -23,10 +23,14 @@ import util.*
|
|||||||
~get3~fun get(i : Object) : Any {return i }
|
~get3~fun get(i : Object) : Any {return i }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Bar~class Bar : Foo {
|
||||||
|
~not~fun not() : String {}
|
||||||
|
}
|
||||||
|
|
||||||
fun <T> tt(t : T) : T {
|
fun <T> tt(t : T) : T {
|
||||||
val x : List = 0
|
val x : List = 0
|
||||||
x`java::java.util.List.get()`[1]
|
x`java::java.util.List.get()`[1]
|
||||||
val foo = new Foo
|
val foo = new Bar
|
||||||
foo`!`[null, 1]
|
foo`!`[null, 1]
|
||||||
foo`get2`[1, 1]
|
foo`get2`[1, 1]
|
||||||
foo`get1`[1]
|
foo`get1`[1]
|
||||||
@@ -36,4 +40,5 @@ fun <T> tt(t : T) : T {
|
|||||||
(x`java::java.util.List.set()`[1]) = null
|
(x`java::java.util.List.set()`[1]) = null
|
||||||
x`!`[null] = null
|
x`!`[null] = null
|
||||||
(x`!`[null, 2]) = null
|
(x`!`[null, 2]) = null
|
||||||
|
(`not`!foo)[1]`:std::Char`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,25 +105,25 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
|
|||||||
assertType("if (true) 1 else null", "Int?");
|
assertType("if (true) 1 else null", "Int?");
|
||||||
assertType("if (true) null else null", "Nothing?");
|
assertType("if (true) null else null", "Nothing?");
|
||||||
|
|
||||||
assertType("if (true) 1 else '1'", "Any");
|
assertType("if (true) 1 else '1'", "Comparable<out Any>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWhen() throws Exception {
|
public void testWhen() throws Exception {
|
||||||
assertType("when (1) { is 1 => 2; } ", "Int");
|
assertType("when (1) { is 1 => 2; } ", "Int");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'} ", "Any");
|
assertType("when (1) { is 1 => 2; is 1 => '2'} ", "Comparable<out Any>");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => null} ", "Any?");
|
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => null} ", "Comparable<out Any>?");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'; else => null} ", "Any?");
|
assertType("when (1) { is 1 => 2; is 1 => '2'; else => null} ", "Comparable<out Any>?");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'; else continue} ", "Any");
|
assertType("when (1) { is 1 => 2; is 1 => '2'; else continue} ", "Comparable<out Any>");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 when(e) {is 1 => null}} ", "Any?");
|
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 when(e) {is 1 => null}} ", "Comparable<out Any>?");
|
||||||
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => when(e) {is 1 => null}} ", "Any?");
|
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => when(e) {is 1 => null}} ", "Comparable<out Any>?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTry() throws Exception {
|
public void testTry() throws Exception {
|
||||||
assertType("try {1} finally{2}", "Int");
|
assertType("try {1} finally{2}", "Int");
|
||||||
assertType("try {1} catch (e : e) {'a'} finally{2}", "Int");
|
assertType("try {1} catch (e : e) {'a'} finally{2}", "Int");
|
||||||
assertType("try {1} catch (e : e) {'a'} finally{'2'}", "Any");
|
assertType("try {1} catch (e : e) {'a'} finally{'2'}", "Comparable<out Any>");
|
||||||
assertType("try {1} catch (e : e) {'a'}", "Any");
|
assertType("try {1} catch (e : e) {'a'}", "Comparable<out Any>");
|
||||||
assertType("try {1} catch (e : e) {'a'} catch (e : e) {null}", "Any?");
|
assertType("try {1} catch (e : e) {'a'} catch (e : e) {null}", "Comparable<out Any>?");
|
||||||
assertType("try {} catch (e : e) {}", "Unit");
|
assertType("try {} catch (e : e) {}", "Unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
|
|||||||
assertCommonSupertype("Int?", "Int", "Nothing?");
|
assertCommonSupertype("Int?", "Int", "Nothing?");
|
||||||
assertCommonSupertype("Nothing?", "Nothing?", "Nothing?");
|
assertCommonSupertype("Nothing?", "Nothing?", "Nothing?");
|
||||||
|
|
||||||
assertCommonSupertype("Any", "Int", "Char");
|
assertCommonSupertype("Comparable<out Any>", "Int", "Char");
|
||||||
|
|
||||||
assertCommonSupertype("Base_T<*>", "Base_T<*>", "Derived_T<*>");
|
assertCommonSupertype("Base_T<*>", "Base_T<*>", "Derived_T<*>");
|
||||||
assertCommonSupertype("Any", "Base_inT<*>", "Derived_T<*>");
|
assertCommonSupertype("Any", "Base_inT<*>", "Derived_T<*>");
|
||||||
|
|||||||
Reference in New Issue
Block a user