Functions types with receivers
This commit is contained in:
@@ -42,6 +42,7 @@ public interface JetNodeTypes {
|
|||||||
JetNodeType LABELED_TUPLE_ENTRY = new JetNodeType("LABELED_TUPLE_ENTRY");
|
JetNodeType LABELED_TUPLE_ENTRY = new JetNodeType("LABELED_TUPLE_ENTRY");
|
||||||
JetNodeType TUPLE_TYPE = new JetNodeType("TUPLE_TYPE");
|
JetNodeType TUPLE_TYPE = new JetNodeType("TUPLE_TYPE");
|
||||||
JetNodeType VALUE_PARAMETER = new JetNodeType("VALUE_PARAMETER");
|
JetNodeType VALUE_PARAMETER = new JetNodeType("VALUE_PARAMETER");
|
||||||
|
JetNodeType FUNCTION_TYPE = new JetNodeType("FUNCTION_TYPE");
|
||||||
|
|
||||||
|
|
||||||
IElementType NAMESPACE_NAME = new JetNodeType("NAMESPACE_NAME");
|
IElementType NAMESPACE_NAME = new JetNodeType("NAMESPACE_NAME");
|
||||||
|
|||||||
@@ -752,12 +752,14 @@ public class JetParsing {
|
|||||||
*/
|
*/
|
||||||
private void parseSimpleFunctionType() {
|
private void parseSimpleFunctionType() {
|
||||||
assert at(LBRACE);
|
assert at(LBRACE);
|
||||||
|
PsiBuilder.Marker functionType = mark();
|
||||||
|
|
||||||
advance(); // LBRACE
|
advance(); // LBRACE
|
||||||
|
|
||||||
parseFunctionTypeContents();
|
parseFunctionTypeContents();
|
||||||
|
|
||||||
expect(RBRACE, "Expecting '}");
|
expect(RBRACE, "Expecting '}");
|
||||||
|
functionType.done(FUNCTION_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -13,4 +13,13 @@ type f = {(foo, a : a) : b}
|
|||||||
type f = {(foo, a : {(a) : b}) : b}
|
type f = {(foo, a : {(a) : b}) : b}
|
||||||
type f = {(foo, a : {(a) : b}) : {() : ()}}
|
type f = {(foo, a : {(a) : b}) : {() : ()}}
|
||||||
|
|
||||||
type f = {(lazy foo, out a : {(ref a) : b}) : {() : ()}}
|
type f = {(lazy foo, out a : {(ref a) : b}) : {() : ()}}
|
||||||
|
|
||||||
|
type f = T.{() : ()}
|
||||||
|
type f = T.T.{() : ()}
|
||||||
|
type f = T<A, B>.T<x>.{() : ()}
|
||||||
|
type f = (S).{() : ()}.{() : ()}
|
||||||
|
type f = T.{() : ()}.{() : ()}
|
||||||
|
type f = T.T.{() : ()}.{() : ()}
|
||||||
|
type f = T<A, B>.T<x>.{() : ()}.{() : ()}
|
||||||
|
type f = (S).{() : ()}.{() : ()}
|
||||||
+771
-413
File diff suppressed because it is too large
Load Diff
@@ -10,29 +10,30 @@ JetFile: FunctionTypes_ERR.jet
|
|||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
PsiElement(LBRACE)('{')
|
FUNCTION_TYPE
|
||||||
VALUE_PARAMETER_LIST
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(LPAR)('(')
|
VALUE_PARAMETER_LIST
|
||||||
MODIFIER_LIST
|
PsiElement(LPAR)('(')
|
||||||
ATTRIBUTE_ANNOTATION
|
MODIFIER_LIST
|
||||||
PsiElement(LBRACKET)('[')
|
ATTRIBUTE_ANNOTATION
|
||||||
ATTRIBUTE
|
PsiElement(LBRACKET)('[')
|
||||||
USER_TYPE
|
ATTRIBUTE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
USER_TYPE
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiErrorElement:Expecting ':' followed by a return type
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('b')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RBRACE)('}')
|
||||||
PsiErrorElement:Expecting ':' followed by a return type
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
USER_TYPE
|
|
||||||
PsiElement(IDENTIFIER)('b')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
TYPEDEF
|
TYPEDEF
|
||||||
PsiElement(type)('type')
|
PsiElement(type)('type')
|
||||||
@@ -44,22 +45,23 @@ JetFile: FunctionTypes_ERR.jet
|
|||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
PsiElement(LBRACE)('{')
|
FUNCTION_TYPE
|
||||||
VALUE_PARAMETER_LIST
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(LPAR)('(')
|
VALUE_PARAMETER_LIST
|
||||||
TYPE_REFERENCE
|
PsiElement(LPAR)('(')
|
||||||
USER_TYPE
|
TYPE_REFERENCE
|
||||||
PsiElement(IDENTIFIER)('a')
|
USER_TYPE
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
PsiErrorElement:Type expected
|
USER_TYPE
|
||||||
<empty list>
|
PsiElement(IDENTIFIER)('b')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
USER_TYPE
|
|
||||||
PsiElement(IDENTIFIER)('b')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
Reference in New Issue
Block a user