KT-1531 Frontend should prohibit secondary constructors
# KT-1531 Fixed
This commit is contained in:
@@ -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>
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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,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>
|
||||
}
|
||||
Reference in New Issue
Block a user