Codegen: Fix origin of overloaded methods generated for constructors with @JvmOverloads
Find Usages: Add tests for declarations annotated with @JvmOverloads #KT-8534 Fixed
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
// OPTIONS: usages
|
||||
@file:JvmName("Foo")
|
||||
|
||||
@JvmOverloads
|
||||
fun <caret>foo(
|
||||
x: Int = 0,
|
||||
y: Double = 0.0,
|
||||
z: String = "0"
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class Usages {
|
||||
void foo() {
|
||||
Foo.foo();
|
||||
}
|
||||
|
||||
void fooX() {
|
||||
Foo.foo(1);
|
||||
}
|
||||
|
||||
void fooXY() {
|
||||
Foo.foo(1, 1.0);
|
||||
}
|
||||
|
||||
void fooXYZ() {
|
||||
Foo.foo(1, 1.0, "1");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Unclassified usage (11: 13) Foo.foo(1, 1.0);
|
||||
Unclassified usage (15: 13) Foo.foo(1, 1.0, "1");
|
||||
Unclassified usage (3: 13) Foo.foo();
|
||||
Unclassified usage (7: 13) Foo.foo(1);
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtPrimaryConstructor
|
||||
// OPTIONS: usages
|
||||
public class A @JvmOverloads <caret>constructor (
|
||||
public val x: Int = 0,
|
||||
public val y: Double = 0.0,
|
||||
public val z: String = "0"
|
||||
)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public class Usages {
|
||||
void createA() {
|
||||
new A();
|
||||
}
|
||||
|
||||
void createAx() {
|
||||
new A(1);
|
||||
}
|
||||
|
||||
void createAxy() {
|
||||
new A(1, 1.0);
|
||||
}
|
||||
|
||||
void createAxyz() {
|
||||
new A(1, 1.0, "1");
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New instance creation (11: 13) new A(1, 1.0);
|
||||
New instance creation (15: 13) new A(1, 1.0, "1");
|
||||
New instance creation (3: 13) new A();
|
||||
New instance creation (7: 13) new A(1);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtSecondaryConstructor
|
||||
// OPTIONS: usages
|
||||
public class A {
|
||||
@JvmOverloads <caret>constructor(x: Int = 0, y: Double = 0.0, z: String = "0")
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public class Usages {
|
||||
void createA() {
|
||||
new A();
|
||||
}
|
||||
|
||||
void createAx() {
|
||||
new A(1);
|
||||
}
|
||||
|
||||
void createAxy() {
|
||||
new A(1, 1.0);
|
||||
}
|
||||
|
||||
void createAxyz() {
|
||||
new A(1, 1.0, "1");
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
New instance creation (11: 13) new A(1, 1.0);
|
||||
New instance creation (15: 13) new A(1, 1.0, "1");
|
||||
New instance creation (3: 13) new A();
|
||||
New instance creation (7: 13) new A(1);
|
||||
Reference in New Issue
Block a user