KT-1130 Remove ref from keywords
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
var x : Int = 1 + x
|
||||
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 = <!TYPE_MISMATCH!>1.lng<!>
|
||||
}
|
||||
|
||||
@@ -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)('>')
|
||||
|
||||
@@ -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)('>')
|
||||
|
||||
@@ -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.() -> #()
|
||||
|
||||
@@ -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
|
||||
<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)(')')
|
||||
PsiComment(EOL_COMMENT)('//type f = (ref foo, ref a : (ref a) -> b) -> () -> #()')
|
||||
PsiWhiteSpace('\n\n')
|
||||
TYPEDEF
|
||||
PsiElement(type)('type')
|
||||
|
||||
@@ -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)('>')
|
||||
|
||||
@@ -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(' ')
|
||||
|
||||
@@ -2,7 +2,8 @@ class Foo<out abstract, out out> {}
|
||||
|
||||
fun f() {
|
||||
|
||||
Foo<out out>
|
||||
// Foo<out out>
|
||||
Foo<out Int>
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@ JetFile: SoftKeywordsInTypeArguments.jet
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiComment(EOL_COMMENT)('// Foo<out out>')
|
||||
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)('}')
|
||||
@@ -36,7 +36,7 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
}
|
||||
|
||||
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<T> : IMutableSet<T> {
|
||||
|
||||
// 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<TreeNode?>, 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user