KT-19574 Code with inferred default parameters and parameter vs property name clashes (#2671)
New J2K: add 'this' receiver to default parameter value if needed #KT-19574 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
1bbd17c4d6
commit
be04912f6f
@@ -0,0 +1,49 @@
|
||||
public class Test {
|
||||
|
||||
private int x = 1;
|
||||
|
||||
private final boolean a = true;
|
||||
|
||||
private final boolean b = true;
|
||||
|
||||
private final boolean c() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final boolean isD() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final E e = new E();
|
||||
|
||||
public static class E {
|
||||
public boolean ee = true;
|
||||
}
|
||||
|
||||
public static class F {
|
||||
public boolean f = true;
|
||||
}
|
||||
|
||||
private final int getG() { return 1; }
|
||||
|
||||
public void foo() {
|
||||
foo(a, this.b, c(), isD(), e.ee, new F().f, getG());
|
||||
}
|
||||
|
||||
public void foo(boolean a, boolean b, boolean c, boolean isD, boolean e, boolean f, int g) {
|
||||
}
|
||||
|
||||
public void bar() {
|
||||
bar(a, a, b);
|
||||
}
|
||||
|
||||
public void bar(boolean a, boolean e, boolean f) {
|
||||
}
|
||||
|
||||
public void baz() {
|
||||
baz(!a, ++x, x++, x + x + 1);
|
||||
}
|
||||
|
||||
public void baz(boolean a, int x, int y, int z) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
class Test {
|
||||
private var x = 1
|
||||
private val a = true
|
||||
private val b = true
|
||||
private fun c(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
private val isD: Boolean
|
||||
private get() = true
|
||||
|
||||
private val e = E()
|
||||
|
||||
class E {
|
||||
var ee = true
|
||||
}
|
||||
|
||||
class F {
|
||||
var f = true
|
||||
}
|
||||
|
||||
private val g: Int
|
||||
private get() = 1
|
||||
|
||||
@JvmOverloads
|
||||
fun foo(a: Boolean = this.a, b: Boolean = this.b, c: Boolean = c(), isD: Boolean = this.isD, e: Boolean = this.e.ee, f: Boolean = F().f, g: Int = this.g) {
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun bar(a: Boolean = this.a, e: Boolean = this.a, f: Boolean = b) {
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun baz(a: Boolean = !this.a, x: Int = ++this.x, y: Int = this.x++, z: Int = this.x + this.x + 1) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user