Allow to use "static" part of class in own constructors by short name, including in primary constructor

This commit is contained in:
Zalim Bashorov
2015-12-08 20:57:45 +03:00
parent f319b1b93a
commit 5bf8b4d946
30 changed files with 1017 additions and 25 deletions
@@ -0,0 +1,65 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!UNRESOLVED_REFERENCE!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!UNRESOLVED_REFERENCE!>a<!>,
t2: Int = <!UNRESOLVED_REFERENCE!>b<!>()
) {
constructor(
dummy: Int,
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
t2: Int = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
) : this(
foo(),
Nested(),
inn,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
i,
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
)
class Nested {
companion object {
const val CONST = 2
}
}
inner class Inner
interface Interface {
companion object {
const val CONST = 3
}
}
val a = 1
fun b() = 2
companion object {
const val CONST = 1
fun foo(): Nested = null!!
}
}