[FIR] Fix generating properties for varargs in primary constructors

This commit is contained in:
Dmitriy Novozhilov
2020-01-23 18:22:23 +03:00
parent 69927409fc
commit 3dfad4f0c3
12 changed files with 68 additions and 50 deletions
@@ -1,9 +1,9 @@
class Foo(vararg val strings: String)
fun test_1(foo: Foo) {
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>for (s in foo.strings) {
s.<!UNRESOLVED_REFERENCE!>length<!>
}<!>
for (s in foo.strings) {
s.length
}
}
fun test_2(vararg strings: String) {
@@ -1,19 +1,19 @@
FILE: iteratorOfVararg.kt
FILE: varargInPrimaryConstructor.kt
public final class Foo : R|kotlin/Any| {
public constructor(vararg strings: R|kotlin/Array<kotlin/String>|): R|Foo| {
super<R|kotlin/Any|>()
}
public final val strings: R|kotlin/String| = R|<local>/strings|
public get(): R|kotlin/String|
public final val strings: R|kotlin/Array<out kotlin/String>| = R|<local>/strings|
public get(): R|kotlin/Array<out kotlin/String>|
}
public final fun test_1(foo: R|Foo|): R|kotlin/Unit| {
lval <range>: R|kotlin/String| = R|<local>/foo|.R|/Foo.strings|
lval <iterator>: <ERROR TYPE REF: Unresolved name: iterator> = R|<local>/<range>|.<Unresolved name: iterator>#()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval s: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
R|<local>/s|.<Unresolved name: length>#
lval <range>: R|kotlin/Array<out kotlin/String>| = R|<local>/foo|.R|/Foo.strings|
lval <iterator>: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/<range>|.R|FakeOverride<kotlin/Array.iterator: R|kotlin/collections/Iterator<kotlin/String>|>|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval s: R|kotlin/String| = R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|kotlin/String|>|()
R|<local>/s|.R|kotlin/String.length|
}
}
@@ -243,6 +243,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/typeParameterVsNested.kt");
}
@TestMetadata("varargInPrimaryConstructor.kt")
public void testVarargInPrimaryConstructor() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/varargInPrimaryConstructor.kt");
}
@TestMetadata("whenAsReceiver.kt")
public void testWhenAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/whenAsReceiver.kt");
@@ -1051,11 +1056,6 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/problems/invokeOfLambdaWithReceiver.kt");
}
@TestMetadata("iteratorOfVararg.kt")
public void testIteratorOfVararg() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/iteratorOfVararg.kt");
}
@TestMetadata("javaAccessorConversion.kt")
public void testJavaAccessorConversion() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");
@@ -243,6 +243,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/typeParameterVsNested.kt");
}
@TestMetadata("varargInPrimaryConstructor.kt")
public void testVarargInPrimaryConstructor() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/varargInPrimaryConstructor.kt");
}
@TestMetadata("whenAsReceiver.kt")
public void testWhenAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/whenAsReceiver.kt");
@@ -1051,11 +1056,6 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/problems/invokeOfLambdaWithReceiver.kt");
}
@TestMetadata("iteratorOfVararg.kt")
public void testIteratorOfVararg() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/iteratorOfVararg.kt");
}
@TestMetadata("javaAccessorConversion.kt")
public void testJavaAccessorConversion() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");