Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt
T
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00

49 lines
1.4 KiB
Kotlin
Vendored

package kt_250_617_10
import java.util.ArrayList
import java.util.HashMap
//KT-250 Incorrect variable resolve in constructor arguments of superclass
open class A(val x: Int)
class B(<!UNUSED_PARAMETER!>y<!>: Int) : A(<!UNRESOLVED_REFERENCE!>x<!>) //x is resolved as a property in a, so no error is generated
//KT-617 Prohibit dollars in call to superclass constructors
open class M(<!UNUSED_PARAMETER!>p<!>: Int)
class N(val p: Int) : A(<!SYNTAX!><!SYNTAX!><!>$p<!><!SYNTAX!>)<!>
//KT-10 Don't allow to use properties in supertype initializers
open class Element()
class TextElement(<!UNUSED_PARAMETER!>name<!>: String) : Element()
abstract class Tag(val name : String) {
val children = ArrayList<Element>()
val attributes = HashMap<String, String>()
}
abstract class TagWithText(name : String) : Tag(name) {
operator fun String.unaryPlus() {
children.add(TextElement(this))
}
}
open class BodyTag(name : String) : TagWithText(name) {
}
class Body() : BodyTag(<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
}
class Body1() : BodyTag(<!NO_THIS!>this<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>name<!>) { // Must be an error!
}
//more tests
open class X(<!UNUSED_PARAMETER!>p<!>: Int, <!UNUSED_PARAMETER!>r<!>: Int) {
val s = "s"
}
class Y(i: Int) : X(i, <!UNRESOLVED_REFERENCE!>rrr<!>) {
val rrr = 3
}
class Z(val i: Int) : X(<!UNRESOLVED_REFERENCE!>s<!>, <!UNRESOLVED_REFERENCE!>x<!>) {
val x = 2
}