Support for secondary constructors in j2k

This commit is contained in:
Valentin Kipyatkov
2015-03-06 19:21:30 +01:00
parent b44dbe6ca2
commit 569e4a68ae
33 changed files with 367 additions and 589 deletions
@@ -1,17 +1,6 @@
// ERROR: 'public fun Test(name: kotlin.String): Test' is already defined in root package
// ERROR: 'public constructor Test(myName: kotlin.String)' is already defined in root package
// ERROR: None of the following functions can be called with the arguments supplied: public fun Test(): Test defined in root package public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
// ERROR: Overload resolution ambiguity: public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
// ERROR: Overload resolution ambiguity: public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
public fun Test(): Test {
return Test(null)
}
public fun Test(name: String): Test {
return Test(Test.foo(name))
}
public class Test(private val myName: String) {
// ERROR: Property must be initialized or be abstract
public class Test {
private val myName: String
var a: Boolean = false
var b: Double = 0.toDouble()
var c: Float = 0.toFloat()
@@ -20,6 +9,13 @@ public class Test(private val myName: String) {
protected var f: Short = 0
protected var g: Char = ' '
public constructor() {
}
public constructor(name: String) {
myName = foo(name)
}
default object {
fun foo(n: String): String {