Support for secondary constructors in j2k
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
fun C(arg1: Int, arg2: Int, arg3: Int): C {
|
||||
val __ = C(arg1)
|
||||
__.myArg2 = arg2
|
||||
__.myArg3 = arg3
|
||||
return __
|
||||
}
|
||||
|
||||
fun C(arg1: Int, arg2: Int): C {
|
||||
val __ = C(arg1)
|
||||
__.myArg2 = arg2
|
||||
__.myArg3 = 0
|
||||
return __
|
||||
}
|
||||
|
||||
class C(val myArg1: Int) {
|
||||
var myArg2: Int = 0
|
||||
var myArg3: Int = 0
|
||||
|
||||
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = arg3
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = 0
|
||||
}
|
||||
|
||||
{
|
||||
myArg2 = 0
|
||||
myArg3 = 0
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
// ERROR: 'public fun Test(s: kotlin.String): Test' is already defined in root package
|
||||
// ERROR: 'public constructor Test(s: 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(s: kotlin.String): Test defined in root package public constructor Test(s: kotlin.String) defined in Test
|
||||
// ERROR: Overload resolution ambiguity: public fun Test(s: kotlin.String): Test defined in root package public constructor Test(s: kotlin.String) defined in Test
|
||||
public fun Test(): Test {
|
||||
val __ = Test(null)
|
||||
__.b = true
|
||||
return __
|
||||
}
|
||||
|
||||
public fun Test(s: String): Test {
|
||||
return Test(s)
|
||||
}
|
||||
|
||||
public class Test(private val s: String) {
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
public class Test {
|
||||
private val s: String
|
||||
var b: Boolean = false
|
||||
var d: Double = 0.toDouble()
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
b = true
|
||||
}
|
||||
|
||||
public constructor(s: String) {
|
||||
this.s = s
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
fun C(arg1: Int, arg2: Int): C {
|
||||
val __ = C(arg1, arg2, 0)
|
||||
System.out.println()
|
||||
return __
|
||||
}
|
||||
class C(arg1: Int, arg2: Int, arg3: Int) {
|
||||
|
||||
fun C(arg1: Int): C {
|
||||
val __ = C(arg1, 0)
|
||||
System.out.println()
|
||||
return __
|
||||
}
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
|
||||
System.out.println()
|
||||
}
|
||||
|
||||
class C(arg1: Int, arg2: Int, arg3: Int)
|
||||
constructor(arg1: Int) : this(arg1, 0) {
|
||||
System.out.println()
|
||||
}
|
||||
}
|
||||
|
||||
public class User {
|
||||
default object {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import javaApi.Anon5
|
||||
|
||||
|
||||
deprecated("") // this constructor will not be replaced by default parameter value in primary because of this annotation
|
||||
fun A(a: Int): A {
|
||||
return A(a, 1)
|
||||
}
|
||||
|
||||
class A
|
||||
[Anon5(10)]
|
||||
(private val a: Int, private val b: Int)
|
||||
(private val a: Int, private val b: Int) {
|
||||
|
||||
deprecated("") // this constructor will not be replaced by default parameter value in primary because of this annotation
|
||||
public constructor(a: Int) : this(a, 1) {
|
||||
}
|
||||
}
|
||||
|
||||
class B [Anon5(11)]
|
||||
()
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
// ERROR: 'public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T>' is already defined in root package
|
||||
// ERROR: 'public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean)' is already defined in root package
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Overload resolution ambiguity: public fun <T> Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier<kotlin.String> defined in root package public constructor Identifier<T>(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
public fun <T> Identifier(name: T): Identifier<T> {
|
||||
return Identifier(name, false)
|
||||
}
|
||||
|
||||
public fun <T> Identifier(name: T, isNullable: Boolean): Identifier<T> {
|
||||
val __ = Identifier(name, false)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public fun <T> Identifier(name: T, hasDollar: Boolean, isNullable: Boolean): Identifier<T> {
|
||||
val __ = Identifier(name, hasDollar)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public class Identifier<T>(public val name: T, private val myHasDollar: Boolean) {
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
public class Identifier<T> {
|
||||
public val name: T
|
||||
private val myHasDollar: Boolean
|
||||
private var myNullable = true
|
||||
|
||||
public constructor(name: T) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
public constructor(name: T, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myNullable = isNullable
|
||||
}
|
||||
|
||||
public constructor(name: T, hasDollar: Boolean, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myHasDollar = hasDollar
|
||||
myNullable = isNullable
|
||||
}
|
||||
}
|
||||
|
||||
public class User {
|
||||
default object {
|
||||
public fun main() {
|
||||
val i1 = Identifier("name", false, true)
|
||||
val i2 = Identifier<String>("name", false)
|
||||
val i2 = Identifier("name", false)
|
||||
val i3 = Identifier("name")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
// ERROR: 'public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier' is already defined in root package
|
||||
// ERROR: 'public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean)' is already defined in root package
|
||||
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
public fun Identifier(name: String): Identifier {
|
||||
return Identifier(name, false)
|
||||
}
|
||||
|
||||
public fun Identifier(name: String, isNullable: Boolean): Identifier {
|
||||
val __ = Identifier(name, false)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public fun Identifier(name: String, hasDollar: Boolean, isNullable: Boolean): Identifier {
|
||||
val __ = Identifier(name, hasDollar)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public class Identifier(public val name: String, private val myHasDollar: Boolean) {
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
public class Identifier {
|
||||
public val name: String
|
||||
private val myHasDollar: Boolean
|
||||
private var myNullable = true
|
||||
|
||||
public constructor(name: String) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
public constructor(name: String, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myNullable = isNullable
|
||||
}
|
||||
|
||||
public constructor(name: String, hasDollar: Boolean, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myHasDollar = hasDollar
|
||||
myNullable = isNullable
|
||||
}
|
||||
}
|
||||
|
||||
public class User {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
// ERROR: Cannot access 'staticFoo': it is 'private' in 'Default'
|
||||
// ERROR: Cannot access 'staticFoo': it is 'private' in 'Default'
|
||||
fun C(arg1: Int, arg2: Int, other: C): C {
|
||||
val __ = C(arg1, arg2, 0)
|
||||
System.out.println(__.foo(1) + __.foo(2) + other.foo(3) + C.staticFoo(4) + C.staticFoo(5))
|
||||
return __
|
||||
}
|
||||
|
||||
class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
|
||||
|
||||
fun foo(p: Int): Int {
|
||||
return p
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
|
||||
System.out.println(foo(1) + this.foo(2) + other.foo(3) + staticFoo(4) + C.staticFoo(5))
|
||||
}
|
||||
|
||||
default object {
|
||||
private fun staticFoo(p: Int): Int {
|
||||
return p
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
fun C(arg1: Int, arg2: Int, arg3: Int): C {
|
||||
return C()
|
||||
}
|
||||
class C {
|
||||
constructor(arg1: Int, arg2: Int, arg3: Int) {
|
||||
}
|
||||
|
||||
fun C(arg1: Int, arg2: Int): C {
|
||||
val __ = C(arg1, arg2, 0)
|
||||
System.out.println()
|
||||
return __
|
||||
}
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
|
||||
System.out.println()
|
||||
}
|
||||
|
||||
fun C(arg: Int): C {
|
||||
val __ = C()
|
||||
System.out.println(arg)
|
||||
return __
|
||||
constructor(arg: Int) {
|
||||
System.out.println(arg)
|
||||
}
|
||||
}
|
||||
|
||||
class C
|
||||
|
||||
public class User {
|
||||
default object {
|
||||
public fun main() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package pack
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
fun C(a: Int): C {
|
||||
return C(a, 0, 0, 0, 1)
|
||||
constructor(a: Int) : this(a, 0, 0, 0, 1) {
|
||||
}
|
||||
}
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
|
||||
@@ -1,12 +1,10 @@
|
||||
package pack
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
fun C(a1: Int, b1: Int, c1: Int): C {
|
||||
return C(a1, b1, c1, 0, 0)
|
||||
constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
|
||||
}
|
||||
|
||||
constructor(b: Byte) : this(b.toInt(), 0, 0, 0, 0) {
|
||||
}
|
||||
}
|
||||
|
||||
fun C(b: Byte): C {
|
||||
return C(b.toInt(), 0, 0, 0, 0)
|
||||
}
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
|
||||
@@ -1,8 +1,7 @@
|
||||
package pack
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
fun C(a: Int, b: Int, c: Int): C {
|
||||
return C(b, a, c, 0, 0)
|
||||
constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
|
||||
}
|
||||
}
|
||||
|
||||
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
|
||||
@@ -1,11 +1,4 @@
|
||||
// ERROR: Overload resolution ambiguity: internal fun C(arg1: kotlin.Int, arg2: kotlin.Int): C defined in root package public constructor C(arg1: kotlin.Int, arg2: kotlin.Int = ..., arg3: kotlin.Int = ...) defined in C
|
||||
fun C(arg1: Int, arg2: Int): C {
|
||||
var arg2 = arg2
|
||||
val __ = C(arg1, arg2, 0)
|
||||
arg2++
|
||||
return __
|
||||
}
|
||||
|
||||
// ERROR: Overload resolution ambiguity: public constructor C(arg1: kotlin.Int, arg2: kotlin.Int) defined in C public constructor C(arg1: kotlin.Int, arg2: kotlin.Int = ..., arg3: kotlin.Int = ...) defined in C
|
||||
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
|
||||
private val field: Int
|
||||
|
||||
@@ -17,6 +10,11 @@ class C(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
|
||||
field = arg3
|
||||
arg3++
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
|
||||
var arg2 = arg2
|
||||
arg2++
|
||||
}
|
||||
}
|
||||
|
||||
public class User {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// ERROR: Too many arguments for internal fun C(arg1: kotlin.Int): C defined in root package
|
||||
// ERROR: Too many arguments for internal fun C(arg1: kotlin.Int): C defined in root package
|
||||
fun C(arg1: Int): C {
|
||||
return C(arg1, 0, 0)
|
||||
}
|
||||
class C private(arg1: Int, arg2: Int, arg3: Int = 0) {
|
||||
|
||||
class C private(arg1: Int, arg2: Int, arg3: Int = 0)
|
||||
public constructor(arg1: Int) : this(arg1, 0, 0) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
// ERROR: Cannot access 'arg1': it is 'private' in 'C'
|
||||
// ERROR: Cannot access 'arg2': it is 'private' in 'C'
|
||||
fun C(arg1: Int, arg2: Int, other: C): C {
|
||||
val __ = C(arg1, arg2, 0)
|
||||
System.out.println(__.arg1 + other.arg2)
|
||||
return __
|
||||
}
|
||||
class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
|
||||
|
||||
class C(private val arg1: Int, private val arg2: Int, private val arg3: Int)
|
||||
constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
|
||||
System.out.println(this.arg1 + other.arg2)
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
fun foo() {
|
||||
|
||||
@@ -1,68 +1,57 @@
|
||||
class Outer {
|
||||
private inner class Inner1() {
|
||||
|
||||
private fun Inner1(a: Int): Inner1 {
|
||||
return Inner1()
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun Inner1(c: Char): Inner1 {
|
||||
return Inner1()
|
||||
protected inner class Inner2() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun Inner1(b: Boolean): Inner1 {
|
||||
return Inner1()
|
||||
inner class Inner3() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
private inner class Inner1
|
||||
public inner class Inner4() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected fun Inner2(a: Int): Inner2 {
|
||||
return Inner2()
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun Inner2(c: Char): Inner2 {
|
||||
return Inner2()
|
||||
}
|
||||
|
||||
private fun Inner2(b: Boolean): Inner2 {
|
||||
return Inner2()
|
||||
}
|
||||
|
||||
protected inner class Inner2
|
||||
|
||||
|
||||
fun Inner3(a: Int): Inner3 {
|
||||
return Inner3()
|
||||
}
|
||||
|
||||
fun Inner3(c: Char): Inner3 {
|
||||
return Inner3()
|
||||
}
|
||||
|
||||
private fun Inner3(b: Boolean): Inner3 {
|
||||
return Inner3()
|
||||
}
|
||||
|
||||
inner class Inner3
|
||||
|
||||
|
||||
public fun Inner4(a: Int): Inner4 {
|
||||
return Inner4()
|
||||
}
|
||||
|
||||
public fun Inner4(c: Char): Inner4 {
|
||||
return Inner4()
|
||||
}
|
||||
|
||||
private fun Inner4(b: Boolean): Inner4 {
|
||||
return Inner4()
|
||||
}
|
||||
|
||||
public inner class Inner4
|
||||
|
||||
fun foo() {
|
||||
val inner1 = Inner1(1)
|
||||
val inner2 = Inner2(2)
|
||||
val inner3 = Inner3(3)
|
||||
val inner4 = Inner4(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +1,55 @@
|
||||
class Outer {
|
||||
private class Nested1() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
protected class Nested2() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Nested3() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
public class Nested4() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
private constructor(b: Boolean) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
default object {
|
||||
|
||||
private fun Nested1(a: Int): Nested1 {
|
||||
return Nested1()
|
||||
}
|
||||
|
||||
private fun Nested1(c: Char): Nested1 {
|
||||
return Nested1()
|
||||
}
|
||||
|
||||
private fun Nested1(b: Boolean): Nested1 {
|
||||
return Nested1()
|
||||
}
|
||||
|
||||
private class Nested1
|
||||
|
||||
|
||||
protected fun Nested2(a: Int): Nested2 {
|
||||
return Nested2()
|
||||
}
|
||||
|
||||
protected fun Nested2(c: Char): Nested2 {
|
||||
return Nested2()
|
||||
}
|
||||
|
||||
private fun Nested2(b: Boolean): Nested2 {
|
||||
return Nested2()
|
||||
}
|
||||
|
||||
protected class Nested2
|
||||
|
||||
|
||||
fun Nested3(a: Int): Nested3 {
|
||||
return Nested3()
|
||||
}
|
||||
|
||||
fun Nested3(c: Char): Nested3 {
|
||||
return Nested3()
|
||||
}
|
||||
|
||||
private fun Nested3(b: Boolean): Nested3 {
|
||||
return Nested3()
|
||||
}
|
||||
|
||||
class Nested3
|
||||
|
||||
|
||||
public fun Nested4(a: Int): Nested4 {
|
||||
return Nested4()
|
||||
}
|
||||
|
||||
public fun Nested4(c: Char): Nested4 {
|
||||
return Nested4()
|
||||
}
|
||||
|
||||
private fun Nested4(b: Boolean): Nested4 {
|
||||
return Nested4()
|
||||
}
|
||||
|
||||
public class Nested4
|
||||
|
||||
fun foo() {
|
||||
val nested1 = Nested1(1)
|
||||
val nested2 = Nested2(2)
|
||||
@@ -67,4 +57,4 @@ class Outer {
|
||||
val nested4 = Nested4(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,29 @@
|
||||
fun A(a: Int): A {
|
||||
return A()
|
||||
class A() {
|
||||
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
constructor(f: Float) : this() {
|
||||
}
|
||||
|
||||
private constructor(d: Double) : this() {
|
||||
}
|
||||
}
|
||||
|
||||
fun A(c: Char): A {
|
||||
return A()
|
||||
}
|
||||
public class B() {
|
||||
|
||||
fun A(f: Float): A {
|
||||
return A()
|
||||
}
|
||||
public constructor(a: Int) : this() {
|
||||
}
|
||||
|
||||
private fun A(d: Double): A {
|
||||
return A()
|
||||
}
|
||||
protected constructor(c: Char) : this() {
|
||||
}
|
||||
|
||||
class A
|
||||
constructor(f: Float) : this() {
|
||||
}
|
||||
|
||||
|
||||
public fun B(a: Int): B {
|
||||
return B()
|
||||
}
|
||||
|
||||
public fun B(c: Char): B {
|
||||
return B()
|
||||
}
|
||||
|
||||
fun B(f: Float): B {
|
||||
return B()
|
||||
}
|
||||
|
||||
private fun B(d: Double): B {
|
||||
return B()
|
||||
}
|
||||
|
||||
public class B
|
||||
private constructor(d: Double) : this() {
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
// ERROR: Cannot access 'staticField1': it is 'private' in 'Default'
|
||||
// ERROR: Cannot access 'staticField2': it is 'private' in 'Default'
|
||||
fun C(p: Int): C {
|
||||
val __ = C()
|
||||
System.out.println(C.staticField1 + C.staticField2)
|
||||
return __
|
||||
}
|
||||
class C() {
|
||||
|
||||
constructor(p: Int) : this() {
|
||||
System.out.println(staticField1 + C.staticField2)
|
||||
}
|
||||
|
||||
class C {
|
||||
default object {
|
||||
private val staticField1 = 0
|
||||
private val staticField2 = 0
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user