Self-types and anonymous initializers
This commit is contained in:
@@ -21,9 +21,9 @@ fun countOnes(x : INumber) = if (x == 0) 0 else mostSignificantBit(x) + countOne
|
||||
|
||||
fun Int.matchMask(mask : Int) = this and mask == mask
|
||||
|
||||
virtual class INumber<T : this> : IComparable<T> {
|
||||
virtual class INumber : IComparable<This> {
|
||||
val bits : Int
|
||||
[operator] fun plus(other : T) : T
|
||||
[operator] fun shl(bits : Int) : T
|
||||
[operator] fun plus(other : This) : This
|
||||
[operator] fun shl(bits : Int) : This
|
||||
// ...
|
||||
}
|
||||
@@ -468,18 +468,9 @@ JetFile: BitArith.jet
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('INumber')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
PsiElement(this)('this')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
@@ -490,8 +481,8 @@ JetFile: BitArith.jet
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
SELF_TYPE
|
||||
PsiElement(This)('This')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
@@ -530,15 +521,15 @@ JetFile: BitArith.jet
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
SELF_TYPE
|
||||
PsiElement(This)('This')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
SELF_TYPE
|
||||
PsiElement(This)('This')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
@@ -569,8 +560,8 @@ JetFile: BitArith.jet
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
SELF_TYPE
|
||||
PsiElement(This)('This')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiComment(EOL_COMMENT)('// ...')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
Reference in New Issue
Block a user