Generated constructors with default parameter values are marked with kotlin.jvm.overloads annotation

This commit is contained in:
Valentin Kipyatkov
2015-04-07 21:27:10 +03:00
parent 1afbb961ee
commit 9b80d49bab
18 changed files with 46 additions and 30 deletions
@@ -1,6 +1,6 @@
package pack
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0)
class C [overloads] (arg1: Int, arg2: Int = 0, arg3: Int = 0)
public object User {
public fun main() {
@@ -1 +1 @@
class C(private val string: String, a: Int = string.length())
class C [overloads] (private val string: String, a: Int = string.length())
@@ -1,4 +1,4 @@
class A(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
class A [overloads] (nested: A.Nested = A.Nested(A.Nested.FIELD)) {
class Nested(p: Int) {
companion object {
@@ -1,7 +1,7 @@
// ERROR: Property must be initialized or be abstract
import A.Nested
class A(nested: Nested = Nested(Nested.FIELD)) {
class A [overloads] (nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
companion object {
@@ -3,7 +3,7 @@ package pack
import pack.A.Nested
class A(nested: Nested = Nested(Nested.FIELD)) {
class A [overloads] (nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
companion object {
@@ -3,7 +3,7 @@ package pack
import pack.A.*
class A(nested: Nested = Nested(Nested.FIELD)) {
class A [overloads] (nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
companion object {
@@ -1,6 +1,6 @@
package pack
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
class C [overloads] (a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
constructor(a: Int) : this(a, 0, 0, 0, 1) {
}
@@ -1,6 +1,6 @@
package pack
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
class C [overloads] (a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
}
@@ -1,6 +1,6 @@
package pack
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
class C [overloads] (a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
}
@@ -1,3 +1,3 @@
package pack
class C(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
class C [overloads] (a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -1,3 +1,3 @@
package pack
class C(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
class C [overloads] (a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -1,5 +1,5 @@
// 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) {
// ERROR: Overload resolution ambiguity: public constructor C(arg1: kotlin.Int, arg2: kotlin.Int) defined in C kotlin.jvm.overloads public constructor C(arg1: kotlin.Int, arg2: kotlin.Int = ..., arg3: kotlin.Int = ...) defined in C
class C [overloads] (arg1: Int, arg2: Int = 0, arg3: Int = 0) {
private val field: Int
init {
@@ -1,4 +1,4 @@
class C private (arg1: Int, arg2: Int, arg3: Int = 0) {
class C [overloads] private (arg1: Int, arg2: Int, arg3: Int = 0) {
public constructor(arg1: Int) : this(arg1, 0, 0) {
}