36665fe3b8
- If class has type arguments (A<T1,..>) then resolve it's delegation call to `this` as for expression A<T1, ..>() like type arguments are explicitly specified. - Same logic works for `super` delegation calls. - It could be just enough to substitute all candidates before resolve but diagnostic messages looks more correct when substitution is performed within CandidateResolver.performResolutionForCandidateCall because it works the same way as when resolving A<T1, ..>(). #KT-6992 Fixed #KT-6993 Fixed #KT-6994 Fixed
27 lines
1.0 KiB
Kotlin
27 lines
1.0 KiB
Kotlin
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
open class B<R1, R2>(x: R1, y: R2)
|
|
|
|
class A0<T1, T2> {
|
|
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y) {}
|
|
|
|
constructor(x: T1, y: T2, z: T2): this(x, 1) {} // ok, delegates to constructor(x: T1, y: Int)
|
|
|
|
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "") {}
|
|
constructor(x: T1): this(x, 1) {}
|
|
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x) {}
|
|
}
|
|
|
|
class A1<T1, T2> : B<T1, T2> {
|
|
constructor(x: T1, y: T2): super(x, y) {}
|
|
constructor(x: T1, y: Int): super(x, <!TYPE_MISMATCH(T2; kotlin.Int)!>y<!>) {}
|
|
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(T2; T1)!>y<!>) {}
|
|
}
|
|
|
|
class A2<T1, T2> : B<T1, Int> {
|
|
constructor(x: T1, y: T2): super(x, <!TYPE_MISMATCH(kotlin.Int; T2)!>y<!>) {}
|
|
constructor(x: T1, y: Int): super(x, y) {}
|
|
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(kotlin.Int; T1)!>y<!>) {}
|
|
constructor(x: T1, y: T2, z: String): super(<!TYPE_MISMATCH(T1; T2)!>y<!>, 1) {}
|
|
}
|
|
|