Add warning for initializers with obsolete syntax
Expected 'init' keyword before class initializer
This commit is contained in:
@@ -7,7 +7,7 @@ class Test<in I> {
|
||||
|
||||
fun apply(<!UNUSED_PARAMETER!>i<!>: I) {}
|
||||
|
||||
{
|
||||
init {
|
||||
foo()
|
||||
this.foo()
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
|
||||
class Test<in I, out O> {
|
||||
private val i: I = getT()
|
||||
|
||||
;{
|
||||
init {
|
||||
apply(i)
|
||||
apply(this.i)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ class Test<in I, out O> {
|
||||
private var i: I = getT()
|
||||
private val j: I
|
||||
|
||||
;{
|
||||
init {
|
||||
j = getT()
|
||||
i = getT()
|
||||
this.i = getT()
|
||||
|
||||
@@ -3,7 +3,7 @@ fun <T> getT(): T = null!!
|
||||
class A<in I>(init: I) {
|
||||
private val i: I
|
||||
|
||||
{
|
||||
init {
|
||||
i = getT()
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class A<in I>(init: I) {
|
||||
|
||||
private var i4 = getT<I>()
|
||||
|
||||
;{
|
||||
init {
|
||||
i2 = getT()
|
||||
i3 = init
|
||||
i4 = i3
|
||||
|
||||
Reference in New Issue
Block a user