From 90b98a63b536da983ba67c1ca8d628138f036074 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 25 Jan 2012 12:46:50 +0400 Subject: [PATCH] KT-1130 Remove ref from keywords --- .../IDEA__No_ProcessCanceledException_.xml | 22 ++++++ .../jet/lang/diagnostics/Errors.java | 2 - .../lang/parsing/JetExpressionParsing.java | 3 +- .../jet/lang/parsing/JetParsing.java | 10 +-- .../jetbrains/jet/lang/psi/JetParameter.java | 13 +--- .../jet/lang/psi/JetValueArgument.java | 11 --- .../jetbrains/jet/lang/psi/ValueArgument.java | 4 -- .../jet/lang/resolve/DescriptorResolver.java | 13 ---- .../jet/lang/resolve/calls/CallMaker.java | 10 --- .../org/jetbrains/jet/lexer/JetTokens.java | 7 +- .../testData/diagnostics/tests/Properties.jet | 2 +- compiler/testData/psi/Attributes.txt | 14 +++- compiler/testData/psi/Attributes_ERR.txt | 14 +++- compiler/testData/psi/FunctionTypes.jet | 2 +- compiler/testData/psi/FunctionTypes.txt | 69 +------------------ compiler/testData/psi/SimpleModifiers.txt | 14 +++- compiler/testData/psi/SoftKeywords.txt | 7 +- .../psi/SoftKeywordsInTypeArguments.jet | 3 +- .../psi/SoftKeywordsInTypeArguments.txt | 6 +- compiler/testData/psi/examples/BinaryTree.jet | 14 ++-- grammar/src/expressions.grm | 2 +- idea/testData/checker/Properties.jet | 2 +- 22 files changed, 92 insertions(+), 152 deletions(-) create mode 100644 .idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml diff --git a/.idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml b/.idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml new file mode 100644 index 00000000000..58141b697da --- /dev/null +++ b/.idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 7c4770a21e5..aeef041bfc3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -197,7 +197,6 @@ public interface Errors { SimpleDiagnosticFactory NAMESPACE_IS_NOT_AN_EXPRESSION = SimpleDiagnosticFactory.create(ERROR, "'namespace' is not an expression, it can only be used on the left-hand side of a dot ('.')"); ParameterizedDiagnosticFactory1 SUPER_IS_NOT_AN_EXPRESSION = ParameterizedDiagnosticFactory1.create(ERROR, "{0} is not an expression, it can only be used on the left-hand side of a dot ('.')"); SimpleDiagnosticFactory DECLARATION_IN_ILLEGAL_CONTEXT = SimpleDiagnosticFactory.create(ERROR, "Declarations are not allowed in this position"); - SimpleDiagnosticFactory REF_SETTER_PARAMETER = SimpleDiagnosticFactory.create(ERROR, "Setter parameters can not be 'ref'"); SimpleDiagnosticFactory SETTER_PARAMETER_WITH_DEFAULT_VALUE = SimpleDiagnosticFactory.create(ERROR, "Setter parameters can not have default values"); SimpleDiagnosticFactory NO_THIS = SimpleDiagnosticFactory.create(ERROR, "'this' is not defined in this context"); SimpleDiagnosticFactory SUPER_NOT_AVAILABLE = SimpleDiagnosticFactory.create(ERROR, "No supertypes are accessible in this context"); @@ -290,7 +289,6 @@ public interface Errors { ParameterizedDiagnosticFactory1 ILLEGAL_SELECTOR = ParameterizedDiagnosticFactory1.create(ERROR, "Expression ''{0}'' cannot be a selector (occur after a dot)"); - SimpleDiagnosticFactory REF_PARAMETER_WITH_VAL_OR_VAR = SimpleDiagnosticFactory.create(ERROR, "'val' and 'var' are not allowed on ref-parameters"); SimpleDiagnosticFactory VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION = SimpleDiagnosticFactory.create(ERROR, "A type annotation is required on a value parameter"); SimpleDiagnosticFactory BREAK_OR_CONTINUE_OUTSIDE_A_LOOP = SimpleDiagnosticFactory.create(ERROR, "'break' and 'continue' are only allowed inside a loop"); ParameterizedDiagnosticFactory1 NOT_A_LOOP_LABEL = ParameterizedDiagnosticFactory1.create(ERROR, "The label ''{0}'' does not denote a loop"); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index c004266e67f..4e7db15ef0e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -1817,7 +1817,7 @@ public class JetExpressionParsing extends AbstractJetParsing { } /* - * (SimpleName "=")? ("out" | "ref")? element + * (SimpleName "=")? element */ private void parseValueArgument() { PsiBuilder.Marker argument = mark(); @@ -1829,7 +1829,6 @@ public class JetExpressionParsing extends AbstractJetParsing { argName.done(VALUE_ARGUMENT_NAME); advance(); // EQ } - if (at(OUT_KEYWORD) || at(REF_KEYWORD)) advance(); // REF or OUT parseExpression(); argument.done(VALUE_ARGUMENT); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index fd72c80bf09..153cc928d49 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -1398,9 +1398,11 @@ public class JetParsing extends AbstractJetParsing { while (true) { PsiBuilder.Marker projection = mark(); - TokenSet lookFor = TokenSet.create(IDENTIFIER); - TokenSet stopAt = TokenSet.create(COMMA, COLON, GT); - parseModifierListWithShortAnnotations(MODIFIER_LIST, lookFor, stopAt); +// TokenSet lookFor = TokenSet.create(IDENTIFIER); +// TokenSet stopAt = TokenSet.create(COMMA, COLON, GT); +// parseModifierListWithShortAnnotations(MODIFIER_LIST, lookFor, stopAt); + // Currently we do not allow annotations + parseModifierList(MODIFIER_LIST, false); if (at(MUL)) { advance(); // MUL @@ -1429,7 +1431,7 @@ public class JetParsing extends AbstractJetParsing { private void parseModifierListWithShortAnnotations(JetNodeType modifierList, TokenSet lookFor, TokenSet stopAt) { int lastId = findLastBefore(lookFor, stopAt, false); - createTruncatedBuilder(lastId).parseModifierList(modifierList, false); + createTruncatedBuilder(lastId).parseModifierList(modifierList, true); } /* diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameter.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameter.java index 1b4fbe1c8d6..74a16d4acb7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameter.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameter.java @@ -44,19 +44,8 @@ public class JetParameter extends JetNamedDeclaration { return null; } - public boolean isRef() { - ASTNode refNode = getRefNode(); - return refNode != null; - } - - @Nullable - public ASTNode getRefNode() { - JetModifierList modifierList = getModifierList(); - return modifierList == null ? null : modifierList.getModifierNode(JetTokens.REF_KEYWORD); - } - public boolean isMutable() { - return findChildByType(JetTokens.VAR_KEYWORD) != null || isRef(); + return findChildByType(JetTokens.VAR_KEYWORD) != null; } public boolean isVarArg() { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetValueArgument.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetValueArgument.java index 97cd551c0ed..14ffab94a1c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetValueArgument.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetValueArgument.java @@ -5,7 +5,6 @@ import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; -import org.jetbrains.jet.lexer.JetTokens; /** * @author max @@ -41,16 +40,6 @@ public class JetValueArgument extends JetElement implements ValueArgument { return getArgumentName() != null; } - @Override - public boolean isOut() { - return findChildByType(JetTokens.OUT_KEYWORD) != null; - } - - @Override - public boolean isRef() { - return findChildByType(JetTokens.REF_KEYWORD) != null; - } - @NotNull @Override public PsiElement asElement() { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/ValueArgument.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/ValueArgument.java index 967a27d3d6a..d7176d5633d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/ValueArgument.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/ValueArgument.java @@ -17,10 +17,6 @@ public interface ValueArgument { boolean isNamed(); - boolean isOut(); - - boolean isRef(); - @NotNull PsiElement asElement(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index d5278801f5b..1fcba9377a9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -10,7 +10,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.JetSemanticServices; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; -import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo; import org.jetbrains.jet.lang.resolve.scopes.JetScope; @@ -229,12 +228,6 @@ public class DescriptorResolver { JetParameter valueParameter = valueParameters.get(i); JetTypeReference typeReference = valueParameter.getTypeReference(); - ASTNode valOrVarNode = valueParameter.getValOrVarNode(); - if (valueParameter.isRef() && valOrVarNode != null) { -// trace.getErrorHandler().genericError(valOrVarNode, "'val' and 'var' are not allowed on ref-parameters"); - trace.report(REF_PARAMETER_WITH_VAL_OR_VAR.on(valOrVarNode)); - } - JetType type; if (typeReference == null) { // trace.getErrorHandler().genericError(valueParameter.getNode(), "A type annotation is required on a value parameter"); @@ -653,15 +646,10 @@ public class DescriptorResolver { resolveVisibilityFromModifiers(setter.getModifierList(), propertyDescriptor.getVisibility()), setter.getBodyExpression() != null, false); if (parameter != null) { - if (parameter.isRef()) { -// trace.getErrorHandler().genericError(parameter.getRefNode(), "Setter parameters can not be 'ref'"); - trace.report(Errors.REF_SETTER_PARAMETER.on(parameter.getRefNode())); - } // This check is redundant: the parser does not allow a default value, but we'll keep it just in case JetExpression defaultValue = parameter.getDefaultValue(); if (defaultValue != null) { -// trace.getErrorHandler().genericError(defaultValue.getNode(), "Setter parameters can not have default values"); trace.report(SETTER_PARAMETER_WITH_DEFAULT_VALUE.on(defaultValue)); } @@ -675,7 +663,6 @@ public class DescriptorResolver { JetType inType = propertyDescriptor.getOutType(); if (inType != null) { if (!TypeUtils.equalTypes(type, inType)) { -// trace.getErrorHandler().genericError(typeReference.getNode(), "Setter parameter type must be equal to the type of the property, i.e. " + inType); trace.report(WRONG_SETTER_PARAMETER_TYPE.on(setter, typeReference, inType)); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallMaker.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallMaker.java index 62f6a07f69b..20d21081143 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallMaker.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallMaker.java @@ -45,16 +45,6 @@ public class CallMaker { return false; } - @Override - public boolean isOut() { - return false; - } - - @Override - public boolean isRef() { - return false; - } - @NotNull @Override public PsiElement asElement() { diff --git a/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java b/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java index 558f50f3e0a..d05cb05b052 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java +++ b/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java @@ -143,9 +143,6 @@ public interface JetTokens { JetKeywordToken FINALLY_KEYWORD = JetKeywordToken.softKeyword("finally"); JetKeywordToken FINAL_KEYWORD = JetKeywordToken.softKeyword("final"); - // TODO: support this as an annotation on arguments. Then, they it probably can not be a soft keyword - JetKeywordToken REF_KEYWORD = JetKeywordToken.softKeyword("ref"); - TokenSet KEYWORDS = TokenSet.create(PACKAGE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, CLASS_KEYWORD, TRAIT_KEYWORD, THIS_KEYWORD, SUPER_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, FUN_KEYWORD, FOR_KEYWORD, NULL_KEYWORD, @@ -158,12 +155,12 @@ public interface JetTokens { TokenSet SOFT_KEYWORDS = TokenSet.create(IMPORT_KEYWORD, WHERE_KEYWORD, BY_KEYWORD, GET_KEYWORD, SET_KEYWORD, ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ANNOTATION_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD, - CATCH_KEYWORD, FINALLY_KEYWORD, REF_KEYWORD, OUT_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD + CATCH_KEYWORD, FINALLY_KEYWORD, OUT_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD ); TokenSet MODIFIER_KEYWORDS = TokenSet.create(ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ANNOTATION_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, - PROTECTED_KEYWORD, REF_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD + PROTECTED_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD ); TokenSet WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.create(WHITE_SPACE, BLOCK_COMMENT, EOL_COMMENT, DOC_COMMENT); TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE); diff --git a/compiler/testData/diagnostics/tests/Properties.jet b/compiler/testData/diagnostics/tests/Properties.jet index ee7555ba64d..6d8361a4f99 100644 --- a/compiler/testData/diagnostics/tests/Properties.jet +++ b/compiler/testData/diagnostics/tests/Properties.jet @@ -1,6 +1,6 @@ var x : Int = 1 + x get() : Int = 1 - set(ref value : Long) { + set(value : Long) { $x = value.int $x = 1.lng } diff --git a/compiler/testData/psi/Attributes.txt b/compiler/testData/psi/Attributes.txt index 1402e8b4ad0..adf1c1de4c8 100644 --- a/compiler/testData/psi/Attributes.txt +++ b/compiler/testData/psi/Attributes.txt @@ -153,7 +153,12 @@ JetFile: Attributes.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') @@ -306,7 +311,12 @@ JetFile: Attributes.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') diff --git a/compiler/testData/psi/Attributes_ERR.txt b/compiler/testData/psi/Attributes_ERR.txt index 7450c8379a6..1f128af6eef 100644 --- a/compiler/testData/psi/Attributes_ERR.txt +++ b/compiler/testData/psi/Attributes_ERR.txt @@ -189,7 +189,12 @@ JetFile: Attributes_ERR.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') @@ -262,7 +267,12 @@ JetFile: Attributes_ERR.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') diff --git a/compiler/testData/psi/FunctionTypes.jet b/compiler/testData/psi/FunctionTypes.jet index 0e94be440f8..5d5ffc415a7 100644 --- a/compiler/testData/psi/FunctionTypes.jet +++ b/compiler/testData/psi/FunctionTypes.jet @@ -13,7 +13,7 @@ type f = (foo, a : a) -> b type f = (foo, a : (a) -> b) -> b type f = (foo, a : (a) -> b) -> () -> #() -type f = (ref foo, ref a : (ref a) -> b) -> () -> #() +//type f = (ref foo, ref a : (ref a) -> b) -> () -> #() type f = T.() -> #() type f = T.T.() -> #() diff --git a/compiler/testData/psi/FunctionTypes.txt b/compiler/testData/psi/FunctionTypes.txt index 80b37454f29..28a77a7562a 100644 --- a/compiler/testData/psi/FunctionTypes.txt +++ b/compiler/testData/psi/FunctionTypes.txt @@ -446,74 +446,7 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') - TYPEDEF - PsiElement(type)('type') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - TYPE_PARAMETER_LIST - - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - MODIFIER_LIST - PsiElement(ref)('ref') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_PARAMETER - MODIFIER_LIST - PsiElement(ref)('ref') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - MODIFIER_LIST - PsiElement(ref)('ref') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - TUPLE_TYPE - PsiElement(HASH)('#') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PsiComment(EOL_COMMENT)('//type f = (ref foo, ref a : (ref a) -> b) -> () -> #()') PsiWhiteSpace('\n\n') TYPEDEF PsiElement(type)('type') diff --git a/compiler/testData/psi/SimpleModifiers.txt b/compiler/testData/psi/SimpleModifiers.txt index 2be64903246..91cb20b4b08 100644 --- a/compiler/testData/psi/SimpleModifiers.txt +++ b/compiler/testData/psi/SimpleModifiers.txt @@ -40,7 +40,12 @@ JetFile: SimpleModifiers.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') @@ -77,7 +82,12 @@ JetFile: SimpleModifiers.jet PsiWhiteSpace('\n ') PsiElement(out)('out') PsiWhiteSpace('\n ') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') diff --git a/compiler/testData/psi/SoftKeywords.txt b/compiler/testData/psi/SoftKeywords.txt index 1a88237090d..70a64a92f32 100644 --- a/compiler/testData/psi/SoftKeywords.txt +++ b/compiler/testData/psi/SoftKeywords.txt @@ -54,7 +54,12 @@ JetFile: SoftKeywords.jet PsiWhiteSpace('\n') PsiElement(out)('out') PsiWhiteSpace('\n') - PsiElement(ref)('ref') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ref') PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/SoftKeywordsInTypeArguments.jet b/compiler/testData/psi/SoftKeywordsInTypeArguments.jet index 6875a0b6ed0..63bdece7168 100644 --- a/compiler/testData/psi/SoftKeywordsInTypeArguments.jet +++ b/compiler/testData/psi/SoftKeywordsInTypeArguments.jet @@ -2,7 +2,8 @@ class Foo {} fun f() { - Foo +// Foo + Foo } diff --git a/compiler/testData/psi/SoftKeywordsInTypeArguments.txt b/compiler/testData/psi/SoftKeywordsInTypeArguments.txt index d5dd71582a1..9ef98d46272 100644 --- a/compiler/testData/psi/SoftKeywordsInTypeArguments.txt +++ b/compiler/testData/psi/SoftKeywordsInTypeArguments.txt @@ -35,7 +35,9 @@ JetFile: SoftKeywordsInTypeArguments.jet PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') + PsiWhiteSpace('\n\n') + PsiComment(EOL_COMMENT)('// Foo') + PsiWhiteSpace('\n ') CALL_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Foo') @@ -48,7 +50,7 @@ JetFile: SoftKeywordsInTypeArguments.jet TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('out') + PsiElement(IDENTIFIER)('Int') PsiElement(GT)('>') PsiWhiteSpace('\n\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/examples/BinaryTree.jet b/compiler/testData/psi/examples/BinaryTree.jet index 7dc1edcde6e..8a60243469d 100644 --- a/compiler/testData/psi/examples/BinaryTree.jet +++ b/compiler/testData/psi/examples/BinaryTree.jet @@ -36,7 +36,7 @@ class BinaryTree : IMutableSet { } override fun add(item : T) : Boolean { - if (add(ref root, null)) { + if (add(Ref(root), null)) { size++ version++ return true @@ -45,15 +45,15 @@ class BinaryTree : IMutableSet { // In principle, this has access to item anyway, but then it's unreachable code // BAD: the naive implementation of ref will create H(T) ref objects, but can be optimized to create only one - fun add(ref node : TreeNode, parent : TreeNode) : Boolean { - if (node == null) { - node = TreeNode(item, parent) + fun add(node : Ref, parent : TreeNode) : Boolean { + if (node[] == null) { + node[] = TreeNode(item, parent) return true } - when (compare(item, node.value)) { + when (compare(item, node[].value)) { EQ -> false - LS -> add(ref node.left, node) - GT -> add(ref node.right, node) + LS -> add(ref node[].left, node) + GT -> add(ref node[].right, node) } } diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm index 2491b7120fa..b0da83d76b1 100644 --- a/grammar/src/expressions.grm +++ b/grammar/src/expressions.grm @@ -232,7 +232,7 @@ typeArguments ; valueArguments - : "(" (SimpleName "=")? ("out" | "ref")? expression{","} ")" + : "(" (SimpleName "=")? expression{","} ")" ; jump diff --git a/idea/testData/checker/Properties.jet b/idea/testData/checker/Properties.jet index 33d454e33ec..915a1954f35 100644 --- a/idea/testData/checker/Properties.jet +++ b/idea/testData/checker/Properties.jet @@ -1,6 +1,6 @@ var x : Int = 1 + x get() : Int = 1 - set(ref value : Long) { + set(value : Long) { $x = value.int $x = 1.lng }