From 5c61079d75e56ae8429e13691443fb834b9fdba5 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Mon, 16 Nov 2020 14:16:10 -0800 Subject: [PATCH] FIR: reproduce KT-43339 (Throwable.stackTrace) --- .../org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java | 5 +++++ .../ir/irText/firProblems/throwableStackTrace.fir.txt | 5 +++++ .../testData/ir/irText/firProblems/throwableStackTrace.kt | 6 ++++++ .../ir/irText/firProblems/throwableStackTrace.txt | 8 ++++++++ .../org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java | 5 +++++ 5 files changed, 29 insertions(+) create mode 100644 compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/throwableStackTrace.kt create mode 100644 compiler/testData/ir/irText/firProblems/throwableStackTrace.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index e95d5c8de5a..a058e3a353a 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1827,6 +1827,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @TestMetadata("throwableStackTrace.kt") + public void testThrowableStackTrace() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt"); + } + @TestMetadata("V8ArrayToList.kt") public void testV8ArrayToList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/V8ArrayToList.kt"); diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.txt new file mode 100644 index 00000000000..9cc317ef8ad --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.fir.txt @@ -0,0 +1,5 @@ +FILE fqName: fileName:/throwableStackTrace.kt + FUN name:foo visibility:public modality:FINAL <> (t:kotlin.Throwable) returnType:kotlin.Unit + VALUE_PARAMETER name:t index:0 type:kotlin.Throwable + BLOCK_BODY + ERROR_CALL 'Unresolved reference: R|kotlin/stackTrace|' type=IrErrorType diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt new file mode 100644 index 00000000000..b4a2c47ed77 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.kt @@ -0,0 +1,6 @@ +// WITH_RUNTIME +// FULL_JDK + +fun foo(t: Throwable) { + t.stackTrace = t.stackTrace +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/firProblems/throwableStackTrace.txt b/compiler/testData/ir/irText/firProblems/throwableStackTrace.txt new file mode 100644 index 00000000000..4c4da60f969 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/throwableStackTrace.txt @@ -0,0 +1,8 @@ +FILE fqName: fileName:/throwableStackTrace.kt + FUN name:foo visibility:public modality:FINAL <> (t:kotlin.Throwable) returnType:kotlin.Unit + VALUE_PARAMETER name:t index:0 type:kotlin.Throwable + BLOCK_BODY + CALL 'public open fun setStackTrace (p0: @[FlexibleNullability] kotlin.Array?): kotlin.Unit declared in kotlin.Throwable' type=kotlin.Unit origin=EQ + $this: GET_VAR 't: kotlin.Throwable declared in .foo' type=kotlin.Throwable origin=null + p0: CALL 'public open fun getStackTrace (): @[FlexibleNullability] kotlin.Array? declared in kotlin.Throwable' type=@[FlexibleNullability] kotlin.Array? origin=GET_PROPERTY + $this: GET_VAR 't: kotlin.Throwable declared in .foo' type=kotlin.Throwable origin=null diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index d9447820c42..f276c5a2813 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1826,6 +1826,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @TestMetadata("throwableStackTrace.kt") + public void testThrowableStackTrace() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt"); + } + @TestMetadata("V8ArrayToList.kt") public void testV8ArrayToList() throws Exception { runTest("compiler/testData/ir/irText/firProblems/V8ArrayToList.kt");