diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.kt b/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.kt new file mode 100644 index 00000000000..757941439be --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.kt @@ -0,0 +1,19 @@ +// See KT-40327 + +interface Foo { + fun some(x: Int = 1, y: Int) +} + +interface Bar { + fun some(x: Int, y: Int = 2) +} + +class Impl : Foo, Bar { + override fun some(x: Int, y: Int) { + // println("x = $x y = $y") + } +} + +fun main() { + Impl().some() +} diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.txt b/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.txt new file mode 100644 index 00000000000..2a1d552b1bc --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.txt @@ -0,0 +1,21 @@ +FILE: defaultParametersFromDifferentScopes.kt + public abstract interface Foo : R|kotlin/Any| { + public abstract fun some(x: R|kotlin/Int| = Int(1), y: R|kotlin/Int|): R|kotlin/Unit| + + } + public abstract interface Bar : R|kotlin/Any| { + public abstract fun some(x: R|kotlin/Int|, y: R|kotlin/Int| = Int(2)): R|kotlin/Unit| + + } + public final class Impl : R|Foo|, R|Bar| { + public constructor(): R|Impl| { + super() + } + + public final override fun some(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Unit| { + } + + } + public final fun main(): R|kotlin/Unit| { + R|/Impl.Impl|().R|/Impl.some|() + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index c761766f36e..df12354b1c9 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -1744,6 +1744,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/problems/complexLambdaWithTypeVariableAsExpectedType.kt"); } + @TestMetadata("defaultParametersFromDifferentScopes.kt") + public void testDefaultParametersFromDifferentScopes() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.kt"); + } + @TestMetadata("definitelyNotNullAndOriginalType.kt") public void testDefinitelyNotNullAndOriginalType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index 9bde1c6ddb7..25bc3496228 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -1744,6 +1744,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/problems/complexLambdaWithTypeVariableAsExpectedType.kt"); } + @TestMetadata("defaultParametersFromDifferentScopes.kt") + public void testDefaultParametersFromDifferentScopes() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/defaultParametersFromDifferentScopes.kt"); + } + @TestMetadata("definitelyNotNullAndOriginalType.kt") public void testDefinitelyNotNullAndOriginalType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt");