FirDefaultParametersResolver: process imported from objects properly

#KT-49083 Fixed
This commit is contained in:
Mikhail Glukhikh
2021-10-13 16:48:22 +03:00
committed by TeamCityServer
parent c5a4a5de42
commit 09bc729b0e
8 changed files with 79 additions and 15 deletions
@@ -0,0 +1,22 @@
FILE: defaultParameterFromBase.kt
public open class Base : R|kotlin/Any| {
public constructor(): R|Base| {
super<R|kotlin/Any|>()
}
public open fun foo(arg: R|kotlin/Int|, def: R|kotlin/String| = String()): R|kotlin/Unit| {
}
}
public final object Derived : R|Base| {
private constructor(): R|Derived| {
super<R|Base|>()
}
public final override fun foo(arg: R|kotlin/Int|, def: R|kotlin/String|): R|kotlin/Unit| {
}
}
public final fun test(): R|kotlin/Unit| {
Q|Derived|.R|/Derived.foo|(Int(42))
}
@@ -0,0 +1,11 @@
import Derived.foo
open class Base {
open fun foo(arg: Int, def: String = "") {}
}
object Derived : Base() {
override fun foo(arg: Int, def: String) {}
}
fun test() {
foo(42) // No value passed for parameter 'def'
}
@@ -5069,6 +5069,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/DailyAggregatedDoubleFactor.kt");
}
@Test
@TestMetadata("defaultParameterFromBase.kt")
public void testDefaultParameterFromBase() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/defaultParameterFromBase.kt");
}
@Test
@TestMetadata("EnumWithToString.kt")
public void testEnumWithToString() throws Exception {
@@ -5069,6 +5069,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/DailyAggregatedDoubleFactor.kt");
}
@Test
@TestMetadata("defaultParameterFromBase.kt")
public void testDefaultParameterFromBase() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/defaultParameterFromBase.kt");
}
@Test
@TestMetadata("EnumWithToString.kt")
public void testEnumWithToString() throws Exception {