KT-1130 Remove ref from keywords
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||||
|
<option name="VM_PARAMETERS" value="-Xmx500m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Didea.ProcessCanceledException=disabled" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||||
|
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<module name="idea" />
|
||||||
|
<envs />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="" />
|
||||||
|
<option name="TRANSPORT" value="0" />
|
||||||
|
<option name="LOCAL" value="true" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<ConfigurationWrapper RunnerId="Debug" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -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 ('.')");
|
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<String> 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 ('.')");
|
ParameterizedDiagnosticFactory1<String> 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 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 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 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");
|
SimpleDiagnosticFactory SUPER_NOT_AVAILABLE = SimpleDiagnosticFactory.create(ERROR, "No supertypes are accessible in this context");
|
||||||
@@ -290,7 +289,6 @@ public interface Errors {
|
|||||||
|
|
||||||
ParameterizedDiagnosticFactory1<String> ILLEGAL_SELECTOR = ParameterizedDiagnosticFactory1.create(ERROR, "Expression ''{0}'' cannot be a selector (occur after a dot)");
|
ParameterizedDiagnosticFactory1<String> 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 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");
|
SimpleDiagnosticFactory BREAK_OR_CONTINUE_OUTSIDE_A_LOOP = SimpleDiagnosticFactory.create(ERROR, "'break' and 'continue' are only allowed inside a loop");
|
||||||
ParameterizedDiagnosticFactory1<String> NOT_A_LOOP_LABEL = ParameterizedDiagnosticFactory1.create(ERROR, "The label ''{0}'' does not denote a loop");
|
ParameterizedDiagnosticFactory1<String> NOT_A_LOOP_LABEL = ParameterizedDiagnosticFactory1.create(ERROR, "The label ''{0}'' does not denote a loop");
|
||||||
|
|||||||
@@ -1817,7 +1817,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (SimpleName "=")? ("out" | "ref")? element
|
* (SimpleName "=")? element
|
||||||
*/
|
*/
|
||||||
private void parseValueArgument() {
|
private void parseValueArgument() {
|
||||||
PsiBuilder.Marker argument = mark();
|
PsiBuilder.Marker argument = mark();
|
||||||
@@ -1829,7 +1829,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
argName.done(VALUE_ARGUMENT_NAME);
|
argName.done(VALUE_ARGUMENT_NAME);
|
||||||
advance(); // EQ
|
advance(); // EQ
|
||||||
}
|
}
|
||||||
if (at(OUT_KEYWORD) || at(REF_KEYWORD)) advance(); // REF or OUT
|
|
||||||
parseExpression();
|
parseExpression();
|
||||||
argument.done(VALUE_ARGUMENT);
|
argument.done(VALUE_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1398,9 +1398,11 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
while (true) {
|
while (true) {
|
||||||
PsiBuilder.Marker projection = mark();
|
PsiBuilder.Marker projection = mark();
|
||||||
|
|
||||||
TokenSet lookFor = TokenSet.create(IDENTIFIER);
|
// TokenSet lookFor = TokenSet.create(IDENTIFIER);
|
||||||
TokenSet stopAt = TokenSet.create(COMMA, COLON, GT);
|
// TokenSet stopAt = TokenSet.create(COMMA, COLON, GT);
|
||||||
parseModifierListWithShortAnnotations(MODIFIER_LIST, lookFor, stopAt);
|
// parseModifierListWithShortAnnotations(MODIFIER_LIST, lookFor, stopAt);
|
||||||
|
// Currently we do not allow annotations
|
||||||
|
parseModifierList(MODIFIER_LIST, false);
|
||||||
|
|
||||||
if (at(MUL)) {
|
if (at(MUL)) {
|
||||||
advance(); // MUL
|
advance(); // MUL
|
||||||
@@ -1429,7 +1431,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
private void parseModifierListWithShortAnnotations(JetNodeType modifierList, TokenSet lookFor, TokenSet stopAt) {
|
private void parseModifierListWithShortAnnotations(JetNodeType modifierList, TokenSet lookFor, TokenSet stopAt) {
|
||||||
int lastId = findLastBefore(lookFor, stopAt, false);
|
int lastId = findLastBefore(lookFor, stopAt, false);
|
||||||
createTruncatedBuilder(lastId).parseModifierList(modifierList, false);
|
createTruncatedBuilder(lastId).parseModifierList(modifierList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -44,19 +44,8 @@ public class JetParameter extends JetNamedDeclaration {
|
|||||||
return null;
|
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() {
|
public boolean isMutable() {
|
||||||
return findChildByType(JetTokens.VAR_KEYWORD) != null || isRef();
|
return findChildByType(JetTokens.VAR_KEYWORD) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVarArg() {
|
public boolean isVarArg() {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.intellij.psi.PsiElement;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
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.lexer.JetTokens;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
@@ -41,16 +40,6 @@ public class JetValueArgument extends JetElement implements ValueArgument {
|
|||||||
return getArgumentName() != null;
|
return getArgumentName() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOut() {
|
|
||||||
return findChildByType(JetTokens.OUT_KEYWORD) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRef() {
|
|
||||||
return findChildByType(JetTokens.REF_KEYWORD) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public PsiElement asElement() {
|
public PsiElement asElement() {
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ public interface ValueArgument {
|
|||||||
|
|
||||||
boolean isNamed();
|
boolean isNamed();
|
||||||
|
|
||||||
boolean isOut();
|
|
||||||
|
|
||||||
boolean isRef();
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
PsiElement asElement();
|
PsiElement asElement();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
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.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
@@ -229,12 +228,6 @@ public class DescriptorResolver {
|
|||||||
JetParameter valueParameter = valueParameters.get(i);
|
JetParameter valueParameter = valueParameters.get(i);
|
||||||
JetTypeReference typeReference = valueParameter.getTypeReference();
|
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;
|
JetType type;
|
||||||
if (typeReference == null) {
|
if (typeReference == null) {
|
||||||
// trace.getErrorHandler().genericError(valueParameter.getNode(), "A type annotation is required on a value parameter");
|
// 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()),
|
resolveVisibilityFromModifiers(setter.getModifierList(), propertyDescriptor.getVisibility()),
|
||||||
setter.getBodyExpression() != null, false);
|
setter.getBodyExpression() != null, false);
|
||||||
if (parameter != null) {
|
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
|
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
||||||
JetExpression defaultValue = parameter.getDefaultValue();
|
JetExpression defaultValue = parameter.getDefaultValue();
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
// trace.getErrorHandler().genericError(defaultValue.getNode(), "Setter parameters can not have default values");
|
|
||||||
trace.report(SETTER_PARAMETER_WITH_DEFAULT_VALUE.on(defaultValue));
|
trace.report(SETTER_PARAMETER_WITH_DEFAULT_VALUE.on(defaultValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,7 +663,6 @@ public class DescriptorResolver {
|
|||||||
JetType inType = propertyDescriptor.getOutType();
|
JetType inType = propertyDescriptor.getOutType();
|
||||||
if (inType != null) {
|
if (inType != null) {
|
||||||
if (!TypeUtils.equalTypes(type, inType)) {
|
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));
|
trace.report(WRONG_SETTER_PARAMETER_TYPE.on(setter, typeReference, inType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,16 +45,6 @@ public class CallMaker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOut() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRef() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public PsiElement asElement() {
|
public PsiElement asElement() {
|
||||||
|
|||||||
@@ -143,9 +143,6 @@ public interface JetTokens {
|
|||||||
JetKeywordToken FINALLY_KEYWORD = JetKeywordToken.softKeyword("finally");
|
JetKeywordToken FINALLY_KEYWORD = JetKeywordToken.softKeyword("finally");
|
||||||
JetKeywordToken FINAL_KEYWORD = JetKeywordToken.softKeyword("final");
|
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,
|
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,
|
THIS_KEYWORD, SUPER_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, FUN_KEYWORD, FOR_KEYWORD,
|
||||||
NULL_KEYWORD,
|
NULL_KEYWORD,
|
||||||
@@ -158,12 +155,12 @@ public interface JetTokens {
|
|||||||
TokenSet SOFT_KEYWORDS = TokenSet.create(IMPORT_KEYWORD, WHERE_KEYWORD, BY_KEYWORD, GET_KEYWORD,
|
TokenSet SOFT_KEYWORDS = TokenSet.create(IMPORT_KEYWORD, WHERE_KEYWORD, BY_KEYWORD, GET_KEYWORD,
|
||||||
SET_KEYWORD, ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ANNOTATION_KEYWORD,
|
SET_KEYWORD, ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ANNOTATION_KEYWORD,
|
||||||
OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_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,
|
TokenSet MODIFIER_KEYWORDS = TokenSet.create(ABSTRACT_KEYWORD, ENUM_KEYWORD,
|
||||||
OPEN_KEYWORD, ANNOTATION_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_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 WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.create(WHITE_SPACE, BLOCK_COMMENT, EOL_COMMENT, DOC_COMMENT);
|
||||||
TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE);
|
TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
var x : Int = 1 + x
|
var x : Int = 1 + x
|
||||||
get() : Int = 1
|
get() : Int = 1
|
||||||
set(<!REF_SETTER_PARAMETER!>ref<!> value : <!WRONG_SETTER_PARAMETER_TYPE!>Long<!>) {
|
set(value : <!WRONG_SETTER_PARAMETER_TYPE!>Long<!>) {
|
||||||
$x = value.int
|
$x = value.int
|
||||||
$x = <!TYPE_MISMATCH!>1.lng<!>
|
$x = <!TYPE_MISMATCH!>1.lng<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,12 @@ JetFile: Attributes.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -306,7 +311,12 @@ JetFile: Attributes.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('T')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(GT)('>')
|
PsiElement(GT)('>')
|
||||||
|
|||||||
@@ -189,7 +189,12 @@ JetFile: Attributes_ERR.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -262,7 +267,12 @@ JetFile: Attributes_ERR.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('T')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(GT)('>')
|
PsiElement(GT)('>')
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ 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 = (ref foo, ref a : (ref a) -> b) -> () -> #()
|
//type f = (ref foo, ref a : (ref a) -> b) -> () -> #()
|
||||||
|
|
||||||
type f = T.() -> #()
|
type f = T.() -> #()
|
||||||
type f = T.T.() -> #()
|
type f = T.T.() -> #()
|
||||||
|
|||||||
@@ -446,74 +446,7 @@ JetFile: FunctionTypes.jet
|
|||||||
PsiElement(LPAR)('(')
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiWhiteSpace('\n\n')
|
PsiWhiteSpace('\n\n')
|
||||||
TYPEDEF
|
PsiComment(EOL_COMMENT)('//type f = (ref foo, ref a : (ref a) -> b) -> () -> #()')
|
||||||
PsiElement(type)('type')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('f')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_PARAMETER_LIST
|
|
||||||
<empty 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)(')')
|
|
||||||
PsiWhiteSpace('\n\n')
|
PsiWhiteSpace('\n\n')
|
||||||
TYPEDEF
|
TYPEDEF
|
||||||
PsiElement(type)('type')
|
PsiElement(type)('type')
|
||||||
|
|||||||
@@ -40,7 +40,12 @@ JetFile: SimpleModifiers.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -77,7 +82,12 @@ JetFile: SimpleModifiers.jet
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('T')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(GT)('>')
|
PsiElement(GT)('>')
|
||||||
|
|||||||
@@ -54,7 +54,12 @@ JetFile: SoftKeywords.jet
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(out)('out')
|
PsiElement(out)('out')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(ref)('ref')
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ref')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(class)('class')
|
PsiElement(class)('class')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ class Foo<out abstract, out out> {}
|
|||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
|
|
||||||
Foo<out out>
|
// Foo<out out>
|
||||||
|
Foo<out Int>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ JetFile: SoftKeywordsInTypeArguments.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n')
|
||||||
|
PsiComment(EOL_COMMENT)('// Foo<out out>')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
CALL_EXPRESSION
|
CALL_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('Foo')
|
PsiElement(IDENTIFIER)('Foo')
|
||||||
@@ -48,7 +50,7 @@ JetFile: SoftKeywordsInTypeArguments.jet
|
|||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('out')
|
PsiElement(IDENTIFIER)('Int')
|
||||||
PsiElement(GT)('>')
|
PsiElement(GT)('>')
|
||||||
PsiWhiteSpace('\n\n')
|
PsiWhiteSpace('\n\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -36,7 +36,7 @@ class BinaryTree<T> : IMutableSet<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun add(item : T) : Boolean {
|
override fun add(item : T) : Boolean {
|
||||||
if (add(ref root, null)) {
|
if (add(Ref(root), null)) {
|
||||||
size++
|
size++
|
||||||
version++
|
version++
|
||||||
return true
|
return true
|
||||||
@@ -45,15 +45,15 @@ class BinaryTree<T> : IMutableSet<T> {
|
|||||||
|
|
||||||
// In principle, this has access to item anyway, but then it's unreachable code
|
// 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
|
// 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 {
|
fun add(node : Ref<TreeNode?>, parent : TreeNode) : Boolean {
|
||||||
if (node == null) {
|
if (node[] == null) {
|
||||||
node = TreeNode(item, parent)
|
node[] = TreeNode(item, parent)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
when (compare(item, node.value)) {
|
when (compare(item, node[].value)) {
|
||||||
EQ -> false
|
EQ -> false
|
||||||
LS -> add(ref node.left, node)
|
LS -> add(ref node[].left, node)
|
||||||
GT -> add(ref node.right, node)
|
GT -> add(ref node[].right, node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ typeArguments
|
|||||||
;
|
;
|
||||||
|
|
||||||
valueArguments
|
valueArguments
|
||||||
: "(" (SimpleName "=")? ("out" | "ref")? expression{","} ")"
|
: "(" (SimpleName "=")? expression{","} ")"
|
||||||
;
|
;
|
||||||
|
|
||||||
jump
|
jump
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
var x : Int = 1 + x
|
var x : Int = 1 + x
|
||||||
get() : Int = 1
|
get() : Int = 1
|
||||||
set(<error>ref</error> value : <error>Long</error>) {
|
set(value : <error>Long</error>) {
|
||||||
$x = value.int
|
$x = value.int
|
||||||
$x = <error>1.lng</error>
|
$x = <error>1.lng</error>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user