JET-6 Perform checks for primary and secondary constructors (In progress)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
class A {
|
||||
class A() {
|
||||
fun equals(a : Any?) : Boolean
|
||||
}
|
||||
|
||||
class B {
|
||||
class B() {
|
||||
fun equals(a : Any?) : Boolean?
|
||||
}
|
||||
|
||||
class C {
|
||||
class C() {
|
||||
fun equals(a : Any?) : Int
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,34 @@
|
||||
class Z {
|
||||
this() : this(1, true) {}
|
||||
|
||||
this(x : Int, y : Boolean) : this<error>(1)</error> {}
|
||||
class NoC
|
||||
class NoC1 : NoC
|
||||
|
||||
class WithC0() : NoC<error>()</error>
|
||||
class WithC1() : NoC
|
||||
class NoC2 : <error>WithC1</error>
|
||||
class NoC3 : WithC1<error>()</error>
|
||||
class WithC2() : <error>WithC1</error>
|
||||
|
||||
class NoPC {
|
||||
<error>this</error>() {}
|
||||
}
|
||||
|
||||
class Foo() : <error>Z</error>, <error>this</error>() {
|
||||
class WithPC0() {
|
||||
this(a : Int) : this() {}
|
||||
}
|
||||
|
||||
class WithPC1(a : Int) {
|
||||
<error>this</error>() {}
|
||||
|
||||
this(b : Long) : this("") {}
|
||||
|
||||
this(s : String) : this(1) {}
|
||||
|
||||
this(b : Char) : this<error>("", 2)</error> {}
|
||||
|
||||
this(b : Byte) : this(""), <error>this(1)</error> {}
|
||||
}
|
||||
|
||||
|
||||
class Foo() : <error>WithPC0</error>, <error>this</error>() {
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import java.util.*;
|
||||
|
||||
class NotRange1 {
|
||||
class NotRange1() {
|
||||
|
||||
}
|
||||
|
||||
class NotRange2 {
|
||||
class NotRange2() {
|
||||
fun iterator() : Unit
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class ImproperIterator1 {
|
||||
fun hasNext() : Boolean
|
||||
}
|
||||
|
||||
class NotRange3 {
|
||||
class NotRange3() {
|
||||
fun iterator() : ImproperIterator1
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class ImproperIterator2 {
|
||||
fun next() : Boolean
|
||||
}
|
||||
|
||||
class NotRange4 {
|
||||
class NotRange4() {
|
||||
fun iterator() : ImproperIterator2
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class ImproperIterator3 {
|
||||
fun next() : Int
|
||||
}
|
||||
|
||||
class NotRange5 {
|
||||
class NotRange5() {
|
||||
fun iterator() : ImproperIterator3
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class AmbiguousHasNextIterator {
|
||||
fun next() : Int
|
||||
}
|
||||
|
||||
class NotRange6 {
|
||||
class NotRange6() {
|
||||
fun iterator() : AmbiguousHasNextIterator
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class ImproperIterator4 {
|
||||
fun next() : Int
|
||||
}
|
||||
|
||||
class NotRange7 {
|
||||
class NotRange7() {
|
||||
fun iterator() : ImproperIterator3
|
||||
}
|
||||
|
||||
@@ -57,11 +57,11 @@ class GoodIterator {
|
||||
fun next() : Int
|
||||
}
|
||||
|
||||
class Range0 {
|
||||
class Range0() {
|
||||
fun iterator() : GoodIterator
|
||||
}
|
||||
|
||||
class Range1 {
|
||||
class Range1() {
|
||||
fun iterator() : Iterator<Int>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class IncDec {
|
||||
class IncDec() {
|
||||
fun inc() : IncDec = this
|
||||
fun dec() : IncDec = this
|
||||
}
|
||||
@@ -15,7 +15,7 @@ fun testIncDec() {
|
||||
x = --x
|
||||
}
|
||||
|
||||
class WrongIncDec {
|
||||
class WrongIncDec() {
|
||||
fun inc() : Int = 1
|
||||
fun dec() : Int = 1
|
||||
}
|
||||
@@ -28,7 +28,7 @@ fun testWrongIncDec() {
|
||||
<error>--</error>x
|
||||
}
|
||||
|
||||
class UnitIncDec {
|
||||
class UnitIncDec() {
|
||||
fun inc() : Unit {}
|
||||
fun dec() : Unit {}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
val p : Int = <error>1</error>
|
||||
get() = 1
|
||||
|
||||
class Test {
|
||||
class Test() {
|
||||
var a : Int
|
||||
var b : Int get() = <error>$a</error>; set(x) {a = x; <error>$a</error> = x}
|
||||
|
||||
this() {
|
||||
this(i : Int) : this() {
|
||||
<error>$b</error> = $a
|
||||
$a = <error>$b</error>
|
||||
a = <error>$b</error>
|
||||
|
||||
@@ -7,3 +7,8 @@ class foo {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class foo() : Bar
|
||||
protected class foo private () : Bar
|
||||
private class foo<T>() : Bar
|
||||
internal class foo<T> private () : Bar
|
||||
@@ -124,4 +124,106 @@ JetFile: Constructors.jet
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(public)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CLASS
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Bar')
|
||||
PsiWhiteSpace('\n')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(protected)('protected')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CLASS
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Bar')
|
||||
PsiWhiteSpace('\n')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CLASS
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Bar')
|
||||
PsiWhiteSpace('\n')
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(internal)('internal')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_PARAMETER_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST
|
||||
PsiElement(private)('private')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CLASS
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Bar')
|
||||
@@ -1,4 +1,4 @@
|
||||
class Z {
|
||||
class Z(a : Int) {
|
||||
~c1~this() : `c2`this(1, true) {}
|
||||
|
||||
~c2~this(x : Int, y : Boolean) : `c1`this() {}
|
||||
|
||||
Reference in New Issue
Block a user