From e09d3aab3a1aa24e494771f34c23257f966af980 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 4 Dec 2013 14:26:48 +0400 Subject: [PATCH] Test for CFA in string templates --- .../cfg/deadCode/stringTemplate.instructions | 22 +++++++++++++++++++ .../testData/cfg/deadCode/stringTemplate.kt | 3 +++ .../jet/cfg/ControlFlowTestGenerated.java | 5 +++++ 3 files changed, 30 insertions(+) create mode 100644 compiler/testData/cfg/deadCode/stringTemplate.instructions create mode 100644 compiler/testData/cfg/deadCode/stringTemplate.kt diff --git a/compiler/testData/cfg/deadCode/stringTemplate.instructions b/compiler/testData/cfg/deadCode/stringTemplate.instructions new file mode 100644 index 00000000000..1a3fd9a4a04 --- /dev/null +++ b/compiler/testData/cfg/deadCode/stringTemplate.instructions @@ -0,0 +1,22 @@ +== test == +fun test() { + "${throw Exception()} ${1}" +} +--------------------- +L0: + + mark({ "${throw Exception()} ${1}" }) + mark("${throw Exception()} ${1}") + mark(throw Exception()) + mark(Exception()) + call(Exception, ) + throw (throw Exception()) NEXT:[] +- r(1) PREV:[] +- r("${throw Exception()} ${1}") PREV:[] +L1: + NEXT:[] PREV:[] +error: + PREV:[throw (throw Exception())] +sink: + PREV:[, ] +===================== diff --git a/compiler/testData/cfg/deadCode/stringTemplate.kt b/compiler/testData/cfg/deadCode/stringTemplate.kt new file mode 100644 index 00000000000..7fe07d547b6 --- /dev/null +++ b/compiler/testData/cfg/deadCode/stringTemplate.kt @@ -0,0 +1,3 @@ +fun test() { + "${throw Exception()} ${1}" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/cfg/ControlFlowTestGenerated.java b/compiler/tests/org/jetbrains/jet/cfg/ControlFlowTestGenerated.java index b06b5d9f3d7..056f84150b9 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/ControlFlowTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/cfg/ControlFlowTestGenerated.java @@ -228,6 +228,11 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest { doTest("compiler/testData/cfg/deadCode/returnInElvis.kt"); } + @TestMetadata("stringTemplate.kt") + public void testStringTemplate() throws Exception { + doTest("compiler/testData/cfg/deadCode/stringTemplate.kt"); + } + } public static Test suite() {