From 648953085f05d6073b0b539104f60b745bde82de Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 30 Jun 2020 12:59:42 +0300 Subject: [PATCH] [FIR] Replace `kotlin/Throwable` with `java/lang/Throwable` in JvmMappedScope #KT-39044 Fixed --- .../testData/resolveWithStdlib/fillInStackTrace.kt | 6 ++++++ .../testData/resolveWithStdlib/fillInStackTrace.txt | 4 ++++ .../kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java | 5 +++++ .../org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt | 2 +- .../targetedBuiltIns/unsupportedFeature.fir.kt | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.txt diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.kt new file mode 100644 index 00000000000..54b5ecc1444 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.kt @@ -0,0 +1,6 @@ +// FULL_JDK +// ISSUE: KT-39044 + +fun test(t: Throwable) { + t.fillInStackTrace() +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.txt new file mode 100644 index 00000000000..3a944b0d827 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.txt @@ -0,0 +1,4 @@ +FILE: fillInStackTrace.kt + public final fun test(t: R|kotlin/Throwable|): R|kotlin/Unit| { + R|/t|.R|java/lang/Throwable.fillInStackTrace|() + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 859b75f654a..4d8c06e939d 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -108,6 +108,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/factoryFunctionOverloads.kt"); } + @TestMetadata("fillInStackTrace.kt") + public void testFillInStackTrace() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/fillInStackTrace.kt"); + } + @TestMetadata("functionAndFunctionN.kt") public void testFunctionAndFunctionN() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/functionAndFunctionN.kt"); diff --git a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt index a129e8573ec..ab4793a0acf 100644 --- a/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt +++ b/compiler/fir/jvm/src/org/jetbrains/kotlin/fir/scopes/jvm/JvmMappedScope.kt @@ -30,12 +30,12 @@ class JvmMappedScope( val jvmSignature = symbol.fir.computeJvmDescriptor() .replace("kotlin/Any", "java/lang/Object") .replace("kotlin/String", "java/lang/String") + .replace("kotlin/Throwable", "java/lang/Throwable") if (jvmSignature in whiteListSignatures) { processor(symbol) } } - declaredMemberScope.processFunctionsByName(name, processor) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt index ac552db0129..a02e5346146 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt @@ -44,7 +44,7 @@ fun foo(x: List, y: Throwable, z: A3) { x.stream() java.util.ArrayList().stream() - y.fillInStackTrace() checkType { _() } + y.fillInStackTrace() checkType { _() } HashMap().getOrDefault(Any(), null)