KT-1531 Frontend should prohibit secondary constructors

# KT-1531 Fixed
This commit is contained in:
Svetlana Isakova
2012-03-27 17:48:04 +04:00
parent 406933557b
commit a91a53f7f1
22 changed files with 53 additions and 52 deletions
+1 -1
View File
@@ -157,7 +157,7 @@ abstract class B1(
class B2() : B1(1, "r") {}
abstract class B3(i: Int) {
this(): this(1)
<warning>this(): this(1)</warning>
}
fun foo(<warning>a</warning>: B3) {
@@ -27,8 +27,8 @@ class WithC() {
val zzz = <error>$a</error>
}
this(a : Int) : this() {
<warning>this(a : Int) : this() {
val <warning>b</warning> = x
}
}</warning>
}
+6 -6
View File
@@ -13,19 +13,19 @@ class <error>NoPC</error> {
}
class WithPC0() {
this(a : Int) : this() {}
<warning>this(a : Int) : this() {}</warning>
}
class WithPC1(a : Int) {
<error>this</error>() {}
<warning><error>this</error>() {}</warning>
this(b : Long) : this("") {}
<warning>this(b : Long) : this("") {}</warning>
this(s : String) : this(1) {}
<warning>this(s : String) : this(1) {}</warning>
this(b : Char) : <error>this</error>("", 2) {}
<warning>this(b : Char) : <error>this</error>("", 2) {}</warning>
this(b : Byte) : this(""), <error>this(1)</error> {}
<warning>this(b : Byte) : this(""), <error>this(1)</error> {}</warning>
}
@@ -134,11 +134,11 @@ fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) <error>{}</error> else
val a = <error>return 1</error>
class A() {
this(a : Int) : this() {
<warning>this(a : Int) : this() {
if (a == 1)
return
return <error>1</error>
}
}</warning>
}
fun illegalConstantBody(): Int = <error>"s"</error>
+2 -2
View File
@@ -16,11 +16,11 @@ class Test() {
var a : Int = 111
var b : Int get() = $a; set(x) {a = x; $a = x}
this(i : Int) : this() {
<warning>this(i : Int) : this() {
<error>$b</error> = $a
$a = <error>$b</error>
a = <error>$b</error>
}
}</warning>
fun f() {
<error>$b</error> = $a
a = <error>$b</error>
@@ -22,7 +22,7 @@ trait T1 {}
trait T2<T> {}
trait Test<error>()</error> {
<error>this</error>(x : Int) {}
<warning><error>this</error>(x : Int) {}</warning>
}
trait Test1 : C2<error>()</error> {}
+1 -1
View File
@@ -1,7 +1,7 @@
open class bar()
trait Foo<error>()</error> : bar<error>()</error>, <error>bar</error>, <error>bar</error> {
<error>this</error>(x : Int) {}
<warning><error>this</error>(x : Int) {}</warning>
}
trait Foo2 : bar, Foo {
@@ -7,12 +7,12 @@
this : Foo
}
this(var bar : Int) : this(1, 1, 1) {
<warning>this(var bar : Int) : this(1, 1, 1) {
bar = <warning>1</warning>
this.bar
1 : Int
val <warning>a</warning> : Int =1
this : Foo
}
}</warning>
}
@@ -1,3 +1,3 @@
class Z() {
this(x : Int) : this() {}
<warning>this(x : Int) : this() {}</warning>
}