Types for function literals
This commit is contained in:
@@ -1412,8 +1412,10 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
if (isFunctionTypeContents) {
|
if (isFunctionTypeContents) {
|
||||||
if (!tryParseValueParameter()) {
|
if (!tryParseValueParameter()) {
|
||||||
parseModifierList(); // lazy, out, ref
|
PsiBuilder.Marker valueParameter = mark();
|
||||||
parseTypeRef();
|
parseModifierList(); // lazy, out, ref
|
||||||
|
parseTypeRef();
|
||||||
|
valueParameter.done(VALUE_PARAMETER);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parseValueParameter();
|
parseValueParameter();
|
||||||
|
|||||||
@@ -2,14 +2,8 @@ package org.jetbrains.jet.lang.resolve;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.psi.JetClass;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.psi.JetDelegationSpecifier;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
import org.jetbrains.jet.lang.psi.JetTypeParameter;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetTypeReference;
|
|
||||||
import org.jetbrains.jet.lang.types.ClassDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
|
||||||
import org.jetbrains.jet.lang.types.Type;
|
|
||||||
import org.jetbrains.jet.lang.types.TypeParameterDescriptor;
|
|
||||||
import org.jetbrains.jet.lexer.JetTokens;
|
import org.jetbrains.jet.lexer.JetTokens;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -106,4 +100,12 @@ public class ClassDescriptorResolver {
|
|||||||
return super.getTypeParameterDescriptor(name);
|
return super.getTypeParameterDescriptor(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public PropertyDescriptor resolvePropertyDescriptor(@NotNull JetScope scope, @NotNull JetParameter parameter) {
|
||||||
|
return new PropertyDescriptor(
|
||||||
|
AttributeResolver.INSTANCE.resolveAttributes(parameter.getModifierList()),
|
||||||
|
parameter.getName(),
|
||||||
|
TypeResolver.INSTANCE.resolveType(scope, parameter.getTypeReference()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,21 @@ public class TypeResolver {
|
|||||||
result[0] = JetStandardClasses.getTupleType(resolveTypes(scope, type.getComponentTypeRefs()));
|
result[0] = JetStandardClasses.getTupleType(resolveTypes(scope, type.getComponentTypeRefs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitFunctionType(JetFunctionType type) {
|
||||||
|
JetTypeReference receiverTypeRef = type.getReceiverTypeRef();
|
||||||
|
Type receiverType = receiverTypeRef == null ? null : resolveType(scope, receiverTypeRef);
|
||||||
|
|
||||||
|
List<Type> parameterTypes = new ArrayList<Type>();
|
||||||
|
for (JetParameter parameter : type.getParameters()) {
|
||||||
|
parameterTypes.add(resolveType(scope, parameter.getTypeReference()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Type returnType = resolveType(scope, type.getReturnTypeRef());
|
||||||
|
|
||||||
|
result[0] = JetStandardClasses.getFunctionType(attributes, receiverType, parameterTypes, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitJetElement(JetElement elem) {
|
public void visitJetElement(JetElement elem) {
|
||||||
throw new IllegalArgumentException("Unsupported type: " + elem);
|
throw new IllegalArgumentException("Unsupported type: " + elem);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ public class JetStandardClasses {
|
|||||||
parameters.add(new TypeParameterDescriptor(
|
parameters.add(new TypeParameterDescriptor(
|
||||||
Collections.<Attribute>emptyList(),
|
Collections.<Attribute>emptyList(),
|
||||||
Variance.OUT_VARIANCE, "T" + j,
|
Variance.OUT_VARIANCE, "T" + j,
|
||||||
Collections.<Type>emptySet()));
|
Collections.singleton(getNullableAnyType())));
|
||||||
}
|
}
|
||||||
TUPLE[i] = new ClassDescriptor(
|
TUPLE[i] = new ClassDescriptor(
|
||||||
Collections.<Attribute>emptyList(),
|
Collections.<Attribute>emptyList(),
|
||||||
@@ -73,6 +74,42 @@ public class JetStandardClasses {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final int FUNCTION_COUNT = 22;
|
||||||
|
private static final ClassDescriptor[] FUNCTION = new ClassDescriptor[FUNCTION_COUNT];
|
||||||
|
private static final ClassDescriptor[] RECEIVER_FUNCTION = new ClassDescriptor[FUNCTION_COUNT];
|
||||||
|
static {
|
||||||
|
for (int i = 0; i < FUNCTION_COUNT; i++) {
|
||||||
|
List<TypeParameterDescriptor> parameters = new ArrayList<TypeParameterDescriptor>();
|
||||||
|
for (int j = 0; j < i; j++) {
|
||||||
|
parameters.add(new TypeParameterDescriptor(
|
||||||
|
Collections.<Attribute>emptyList(),
|
||||||
|
Variance.IN_VARIANCE, "P" + j,
|
||||||
|
Collections.singleton(getNullableAnyType())));
|
||||||
|
}
|
||||||
|
parameters.add(new TypeParameterDescriptor(
|
||||||
|
Collections.<Attribute>emptyList(),
|
||||||
|
Variance.OUT_VARIANCE, "R",
|
||||||
|
Collections.singleton(getNullableAnyType())));
|
||||||
|
FUNCTION[i] = new ClassDescriptor(
|
||||||
|
Collections.<Attribute>emptyList(),
|
||||||
|
false,
|
||||||
|
"Function" + i,
|
||||||
|
parameters,
|
||||||
|
Collections.singleton(JetStandardClasses.getAnyType()));
|
||||||
|
parameters.add(0, new TypeParameterDescriptor(
|
||||||
|
Collections.<Attribute>emptyList(),
|
||||||
|
Variance.IN_VARIANCE, "T",
|
||||||
|
Collections.singleton(getNullableAnyType())));
|
||||||
|
RECEIVER_FUNCTION[i] = new ClassDescriptor(
|
||||||
|
Collections.<Attribute>emptyList(),
|
||||||
|
false,
|
||||||
|
"ReceiverFunction" + i,
|
||||||
|
parameters,
|
||||||
|
Collections.singleton(JetStandardClasses.getAnyType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final TypeMemberDomain STUB = new TypeMemberDomain() {
|
public static final TypeMemberDomain STUB = new TypeMemberDomain() {
|
||||||
@Override
|
@Override
|
||||||
public ClassDescriptor getClassDescriptor(@NotNull Type type) {
|
public ClassDescriptor getClassDescriptor(@NotNull Type type) {
|
||||||
@@ -259,4 +296,23 @@ public class JetStandardClasses {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : labeled version?
|
||||||
|
public static Type getFunctionType(List<Attribute> attributes, @Nullable Type receiverType, @NotNull List<Type> parameterTypes, @NotNull Type returnType) {
|
||||||
|
List<TypeProjection> arguments = new ArrayList<TypeProjection>();
|
||||||
|
if (receiverType != null) {
|
||||||
|
arguments.add(defaultProjection(receiverType));
|
||||||
|
}
|
||||||
|
for (Type parameterType : parameterTypes) {
|
||||||
|
arguments.add(defaultProjection(parameterType));
|
||||||
|
}
|
||||||
|
arguments.add(defaultProjection(returnType));
|
||||||
|
int size = parameterTypes.size();
|
||||||
|
TypeConstructor constructor = receiverType == null ? FUNCTION[size].getTypeConstructor() : RECEIVER_FUNCTION[size].getTypeConstructor();
|
||||||
|
return new TypeImpl(attributes, constructor, false, arguments, STUB);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TypeProjection defaultProjection(Type returnType) {
|
||||||
|
return new TypeProjection(Variance.INVARIANT, returnType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
|
import org.jetbrains.jet.lang.resolve.ClassDescriptorResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.JetScope;
|
import org.jetbrains.jet.lang.resolve.JetScope;
|
||||||
|
import org.jetbrains.jet.lang.resolve.JetScopeAdapter;
|
||||||
import org.jetbrains.jet.lang.resolve.TypeResolver;
|
import org.jetbrains.jet.lang.resolve.TypeResolver;
|
||||||
import org.jetbrains.jet.lexer.JetTokens;
|
import org.jetbrains.jet.lexer.JetTokens;
|
||||||
|
|
||||||
@@ -34,6 +36,65 @@ public class JetTypeChecker {
|
|||||||
public Type getType(@NotNull final JetScope scope, @NotNull JetExpression expression) {
|
public Type getType(@NotNull final JetScope scope, @NotNull JetExpression expression) {
|
||||||
final Type[] result = new Type[1];
|
final Type[] result = new Type[1];
|
||||||
expression.accept(new JetVisitor() {
|
expression.accept(new JetVisitor() {
|
||||||
|
@Override
|
||||||
|
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||||
|
// TODO : other members
|
||||||
|
// TODO : type substitutions???
|
||||||
|
PropertyDescriptor property = scope.getProperty(expression.getReferencedName());
|
||||||
|
if (property != null) {
|
||||||
|
result[0] = property.getType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||||
|
JetTypeReference returnTypeRef = expression.getReturnTypeRef();
|
||||||
|
|
||||||
|
JetTypeReference receiverTypeRef = expression.getReceiverTypeRef();
|
||||||
|
final Type thisType;
|
||||||
|
if (receiverTypeRef != null) {
|
||||||
|
thisType = TypeResolver.INSTANCE.resolveType(scope, receiverTypeRef);
|
||||||
|
} else {
|
||||||
|
thisType = scope.getThisType();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<JetExpression> body = expression.getBody();
|
||||||
|
final Map<String, PropertyDescriptor> parameterDescriptors = new HashMap<String, PropertyDescriptor>();
|
||||||
|
List<Type> parameterTypes = new ArrayList<Type>();
|
||||||
|
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.INSTANCE.resolvePropertyDescriptor(scope, parameter);
|
||||||
|
parameterDescriptors.put(parameter.getName(), propertyDescriptor);
|
||||||
|
parameterTypes.add(propertyDescriptor.getType());
|
||||||
|
}
|
||||||
|
Type returnType;
|
||||||
|
if (returnTypeRef != null) {
|
||||||
|
returnType = TypeResolver.INSTANCE.resolveType(scope, returnTypeRef);
|
||||||
|
} else if (body.isEmpty()) {
|
||||||
|
returnType = JetStandardClasses.getUnitType();
|
||||||
|
} else {
|
||||||
|
returnType = getType(new JetScopeAdapter(scope) {
|
||||||
|
@Override
|
||||||
|
public Type getThisType() {
|
||||||
|
return thisType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PropertyDescriptor getProperty(String name) {
|
||||||
|
PropertyDescriptor propertyDescriptor = parameterDescriptors.get(name);
|
||||||
|
if (propertyDescriptor == null) {
|
||||||
|
return super.getProperty(name);
|
||||||
|
}
|
||||||
|
return propertyDescriptor;
|
||||||
|
}
|
||||||
|
}, body.get(body.size() - 1));
|
||||||
|
}
|
||||||
|
result[0] = JetStandardClasses.getFunctionType(null, receiverTypeRef == null ? null : thisType, parameterTypes, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||||
result[0] = getType(scope, expression.getExpression());
|
result[0] = getType(scope, expression.getExpression());
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author abreslav
|
* @author abreslav
|
||||||
*/
|
*/
|
||||||
public class PropertyDescriptor {
|
public class PropertyDescriptor extends MemberDescriptorImpl {
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
public PropertyDescriptor(List<Attribute> attributes, String name, Type type) {
|
||||||
|
super(attributes, name);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropertyDescriptor(List<Attribute> attributes, String name) {
|
||||||
|
this(attributes, name, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ public class TypeConstructor extends AnnotatedImpl {
|
|||||||
super(attributes);
|
super(attributes);
|
||||||
this.sealed = sealed;
|
this.sealed = sealed;
|
||||||
this.debugName = debugName;
|
this.debugName = debugName;
|
||||||
this.parameters = parameters;
|
this.parameters = new ArrayList<TypeParameterDescriptor>(parameters);
|
||||||
this.supertypes = supertypes;
|
this.supertypes = supertypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,20 +14,21 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
MODIFIER_LIST
|
VALUE_PARAMETER
|
||||||
ATTRIBUTE_ANNOTATION
|
MODIFIER_LIST
|
||||||
PsiElement(LBRACKET)('[')
|
ATTRIBUTE_ANNOTATION
|
||||||
ATTRIBUTE
|
PsiElement(LBRACKET)('[')
|
||||||
TYPE_REFERENCE
|
ATTRIBUTE
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(RBRACKET)(']')
|
||||||
TYPE_REFERENCE
|
PsiWhiteSpace(' ')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -52,10 +53,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -280,10 +282,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
@@ -319,10 +322,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
@@ -358,10 +362,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
@@ -374,10 +379,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -411,10 +417,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
@@ -427,10 +434,11 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -474,13 +482,14 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
MODIFIER_LIST
|
VALUE_PARAMETER
|
||||||
PsiElement(ref)('ref')
|
MODIFIER_LIST
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(ref)('ref')
|
||||||
TYPE_REFERENCE
|
PsiWhiteSpace(' ')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER
|
VALUE_PARAMETER
|
||||||
@@ -496,13 +505,14 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
MODIFIER_LIST
|
VALUE_PARAMETER
|
||||||
PsiElement(ref)('ref')
|
MODIFIER_LIST
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(ref)('ref')
|
||||||
TYPE_REFERENCE
|
PsiWhiteSpace(' ')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -14,20 +14,21 @@ JetFile: FunctionTypes_ERR.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
MODIFIER_LIST
|
VALUE_PARAMETER
|
||||||
ATTRIBUTE_ANNOTATION
|
MODIFIER_LIST
|
||||||
PsiElement(LBRACKET)('[')
|
ATTRIBUTE_ANNOTATION
|
||||||
ATTRIBUTE
|
PsiElement(LBRACKET)('[')
|
||||||
TYPE_REFERENCE
|
ATTRIBUTE
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(RBRACKET)(']')
|
||||||
TYPE_REFERENCE
|
PsiWhiteSpace(' ')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiErrorElement:Expecting ':' followed by a return type
|
PsiErrorElement:Expecting ':' followed by a return type
|
||||||
<empty list>
|
<empty list>
|
||||||
@@ -52,10 +53,11 @@ JetFile: FunctionTypes_ERR.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiErrorElement:Expecting a parameter declaration
|
PsiErrorElement:Expecting a parameter declaration
|
||||||
<empty list>
|
<empty list>
|
||||||
|
|||||||
@@ -83,18 +83,19 @@ JetFile: Functions.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('A')
|
REFERENCE_EXPRESSION
|
||||||
TYPE_ARGUMENT_LIST
|
PsiElement(IDENTIFIER)('A')
|
||||||
PsiElement(LT)('<')
|
TYPE_ARGUMENT_LIST
|
||||||
TYPE_PROJECTION
|
PsiElement(LT)('<')
|
||||||
TYPE_REFERENCE
|
TYPE_PROJECTION
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('B')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(GT)('>')
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(GT)('>')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -185,10 +186,11 @@ JetFile: Functions.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -305,18 +307,19 @@ JetFile: Functions.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('A')
|
REFERENCE_EXPRESSION
|
||||||
TYPE_ARGUMENT_LIST
|
PsiElement(IDENTIFIER)('A')
|
||||||
PsiElement(LT)('<')
|
TYPE_ARGUMENT_LIST
|
||||||
TYPE_PROJECTION
|
PsiElement(LT)('<')
|
||||||
TYPE_REFERENCE
|
TYPE_PROJECTION
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('B')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(GT)('>')
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(GT)('>')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -409,10 +412,11 @@ JetFile: Functions.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -539,18 +543,19 @@ JetFile: Functions.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('A')
|
REFERENCE_EXPRESSION
|
||||||
TYPE_ARGUMENT_LIST
|
PsiElement(IDENTIFIER)('A')
|
||||||
PsiElement(LT)('<')
|
TYPE_ARGUMENT_LIST
|
||||||
TYPE_PROJECTION
|
PsiElement(LT)('<')
|
||||||
TYPE_REFERENCE
|
TYPE_PROJECTION
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('B')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(GT)('>')
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(GT)('>')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -649,10 +654,11 @@ JetFile: Functions.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -726,18 +732,19 @@ JetFile: Functions.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('A')
|
REFERENCE_EXPRESSION
|
||||||
TYPE_ARGUMENT_LIST
|
PsiElement(IDENTIFIER)('A')
|
||||||
PsiElement(LT)('<')
|
TYPE_ARGUMENT_LIST
|
||||||
TYPE_PROJECTION
|
PsiElement(LT)('<')
|
||||||
TYPE_REFERENCE
|
TYPE_PROJECTION
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('B')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(GT)('>')
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(GT)('>')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -801,10 +808,11 @@ JetFile: Functions.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -109,10 +109,11 @@ JetFile: Functions_ERR.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -416,18 +417,19 @@ JetFile: Functions_ERR.jet
|
|||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('A')
|
REFERENCE_EXPRESSION
|
||||||
TYPE_ARGUMENT_LIST
|
PsiElement(IDENTIFIER)('A')
|
||||||
PsiElement(LT)('<')
|
TYPE_ARGUMENT_LIST
|
||||||
TYPE_PROJECTION
|
PsiElement(LT)('<')
|
||||||
TYPE_REFERENCE
|
TYPE_PROJECTION
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('B')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(GT)('>')
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(GT)('>')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -746,10 +746,11 @@ JetFile: When.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('foo')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -44,16 +45,18 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('E')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('E')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -80,20 +83,21 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
TUPLE_TYPE
|
TYPE_REFERENCE
|
||||||
PsiElement(LPAR)('(')
|
TUPLE_TYPE
|
||||||
TYPE_REFERENCE
|
PsiElement(LPAR)('(')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(COMMA)(',')
|
||||||
TYPE_REFERENCE
|
PsiWhiteSpace(' ')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('E')
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(IDENTIFIER)('E')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -121,10 +125,11 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('X')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('X')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -134,10 +139,11 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -167,24 +173,26 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
FUNCTION_TYPE
|
TYPE_REFERENCE
|
||||||
PsiElement(LBRACE)('{')
|
FUNCTION_TYPE
|
||||||
VALUE_PARAMETER_LIST
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(LPAR)('(')
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('X')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('X')
|
PsiElement(IDENTIFIER)('Y')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('Y')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -194,10 +202,11 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('Y')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Y')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -643,10 +652,11 @@ JetFile: FunctionsAndTypes.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -494,10 +494,11 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('V')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('V')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -641,10 +642,11 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('V')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('V')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -812,10 +814,11 @@ JetFile: Graph.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('V')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('V')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -299,10 +299,11 @@ JetFile: PolymorphicClassObjects.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('E')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('E')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -20,16 +20,18 @@ JetFile: Comparison.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
@@ -254,16 +256,18 @@ JetFile: Comparison.jet
|
|||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
VALUE_PARAMETER_LIST
|
VALUE_PARAMETER_LIST
|
||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
VALUE_PARAMETER
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
REFERENCE_EXPRESSION
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('T')
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
|
|||||||
@@ -274,6 +274,28 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
|
|||||||
assertType("for (i in 1) {1}", "Unit");
|
assertType("for (i in 1) {1}", "Unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testFunctionLiterals() throws Exception {
|
||||||
|
assertType("{() => }", "{() : Unit}");
|
||||||
|
assertType("{() : Int => }", "{() : Int}");
|
||||||
|
assertType("{() => 1}", "{() : Int}");
|
||||||
|
|
||||||
|
assertType("{(a : Int) => 1}", "{(a : Int) : Int}");
|
||||||
|
assertType("{(a : Int, b : String) => 1}", "{(a : Int, b : String) : Int}");
|
||||||
|
|
||||||
|
assertType("{(a : Int) => 1}", "{(Int) : Int}");
|
||||||
|
assertType("{(a : Int, b : String) => 1}", "{(Int, String) : Int}");
|
||||||
|
|
||||||
|
assertType("{Any.() => 1}", "{Any.() : Int}");
|
||||||
|
|
||||||
|
assertType("{Any.(a : Int) => 1}", "{Any.(a : Int) : Int}");
|
||||||
|
assertType("{Any.(a : Int, b : String) => 1}", "{Any.(a : Int, b : String) : Int}");
|
||||||
|
|
||||||
|
assertType("{Any.(a : Int) => 1}", "{Any.(Int) : Int}");
|
||||||
|
assertType("{Any.(a : Int, b : String) => 1}", "{Any.(Int, String) : Int}");
|
||||||
|
|
||||||
|
assertType("{Any.(a : Int, b : String) => b}", "{Any.(Int, String) : String}");
|
||||||
|
}
|
||||||
|
|
||||||
public void testImplicitConversions() throws Exception {
|
public void testImplicitConversions() throws Exception {
|
||||||
assertConvertibleTo("1", JetStandardClasses.getByteType());
|
assertConvertibleTo("1", JetStandardClasses.getByteType());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user