Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/sealedClass.kt
T
Tianyu Geng ae902e6fe5 FIR: fix source of callee reference in delegated constructor call
Previously the callee reference of a delegated constructor call is
always the same as the call itself. This violates the contract that no
two FIR elements can have identical sources.  In addition, this sets the
entire call expression as the source of the callee expression.

This change instead sets the proper constructor ref as the callee.

Also fixed EXPLICIT_DELEGATION_CALL_REQUIRED type. It should be an error
instead of a warning.
2021-03-29 12:45:27 +03:00

11 lines
314 B
Kotlin
Vendored

sealed class Foo(val value: String)
class Bar : Foo("OK")
sealed class WithPrivateConstructor private constructor(val x: Int) {
private constructor() : this(42)
}
object First : <!NONE_APPLICABLE!>WithPrivateConstructor<!>() // error
object Second : <!NONE_APPLICABLE!>WithPrivateConstructor<!>(0) // error