Merge branch 'master' of ssh://git.labs.intellij.net/jet

This commit is contained in:
svtk
2011-10-24 18:54:35 +04:00
94 changed files with 1561 additions and 263 deletions
@@ -0,0 +1,21 @@
trait T {
fun foo() {}
fun buzz() {}
fun buzz1(i : Int) {}
}
fun T.bar() {}
fun T.buzz() {}
fun T.buzz1() {}
class C : T {
fun test() {
fun T.buzz() {}
fun T.buzz1() {}
super.foo() // OK
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>.bar() // Error
super.buzz() // OK, resolved to a member
super.<!NO_VALUE_FOR_PARAMETER!>buzz1<!>() // Resolved to a member, but error: no parameter passed where required
}
}
@@ -1,5 +1,17 @@
namespace example;
fun any(a : Any) {}
fun notAnExpression() {
any(<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) // not an expression
if (<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) {} else {} // not an expression
val x = <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> // not an expression
when (1) {
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!> => 1 // not an expression
}
}
trait T {
fun foo() {}
}
@@ -72,6 +84,6 @@ class ERROR<E>() : <!UNRESOLVED_REFERENCE!>UR<!> {
// No supertype at all
class A1 {
fun test() {
super.equals(null)
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>.equals(null)
}
}
@@ -0,0 +1,3 @@
fun foo(f : fun()) {
val x : Unit = f()
}
@@ -0,0 +1,13 @@
trait Iterator<out T> {
fun next() : T
val hasNext : Boolean
fun <R> map(transform: fun(element: T) : R) : Iterator<R> =
object : Iterator<R> {
override fun next() : R = transform(<!NO_THIS!>this@map<!>.next())
override val hasNext : Boolean
// There's no 'this' associated with the map() function, only this of the Iterator class
get() = <!NO_THIS!>this@map<!>.hasNext
}
}
@@ -88,7 +88,8 @@ class MyCollection2(): Iterable<Int> {
var k : Int = 5
override fun next() : Int = k--
override fun hasNext() = k > 0
override val hasNext : Boolean
get() = k > 0
}
}
@@ -99,7 +100,8 @@ class MyCollection3() {
var k : Int = 5
fun next() : Int? = k--
fun hasNext() = k > 0
val hasNext : Boolean
get() = k > 0
}
}
+7
View File
@@ -0,0 +1,7 @@
// KT-156 Fix the this<Super> syntax
fun foo() {
super.foo();
super<Int>.foo();
super<>.foo();
super<Int>@label.foo();
}
+88
View File
@@ -0,0 +1,88 @@
JetFile: Super.jet
PsiComment(EOL_COMMENT)('// KT-156 Fix the this<Super> syntax')
PsiWhiteSpace('\n')
NAMESPACE
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION
SUPER_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(super)('super')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION
SUPER_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(super)('super')
PsiElement(LT)('<')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(GT)('>')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION
SUPER_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(super)('super')
PsiElement(LT)('<')
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(GT)('>')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION
SUPER_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(super)('super')
PsiElement(LT)('<')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(GT)('>')
LABEL_QUALIFIER
LABEL_REFERENCE
PsiElement(LABEL_IDENTIFIER)('@label')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+36
View File
@@ -0,0 +1,36 @@
~T~trait T {
fun foo() {}
}
~C~open class C() {
fun bar() {}
}
~A~class A<E>() : C(), T {
fun test() {
`T`super<T>.foo()
`C`super<C>.bar()
`T`super<T>@A.foo()
`C`super<C>@A.bar()
}
class B : T {
fun test() {
`T`super<T>.foo();
`C`super<C>@A.bar()
`T`super<T>@A.foo()
`T`super<T>@B.foo()
`T`super.foo()
}
}
}
~G~trait G<T> {
fun foo() {}
}
class CG : G<Int> {
fun test() {
`G`super<`G`G>.foo() // OK
}
}