From 0cda737dcabe3513f04b86eb2dbc2321e28fe8fe Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Sun, 25 Aug 2024 19:34:20 +0200 Subject: [PATCH] Add test for bug in nullness analysis --- .../model/analysis/test/NullnessAnalysisTest.java | 7 +++++++ .../nullness/nonDominatedBranch2.extended.txt | 10 ++++++++++ .../nullness/nonDominatedBranch2.original.txt | 11 +++++++++++ 3 files changed, 28 insertions(+) create mode 100644 core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.extended.txt create mode 100644 core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.original.txt diff --git a/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java b/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java index 0101096bf..148da004e 100644 --- a/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java +++ b/core/src/test/java/org/teavm/model/analysis/test/NullnessAnalysisTest.java @@ -29,6 +29,7 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -84,6 +85,12 @@ public class NullnessAnalysisTest { test(); } + @Test + @Ignore + public void nonDominatedBranch2() { + test(); + } + @Test public void exception() { test(); diff --git a/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.extended.txt b/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.extended.txt new file mode 100644 index 000000000..9b3101b78 --- /dev/null +++ b/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.extended.txt @@ -0,0 +1,10 @@ +var @this as this // 0 +$0 + @a := invokeStatic `Foo.f()LBar;` + if @a === null then goto $2 else goto $1 +$1 + goto $2 +$2 + @c := phi @a_1 from $0, @a_2 from $1 + @d := @a + return @c diff --git a/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.original.txt b/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.original.txt new file mode 100644 index 000000000..036d96a51 --- /dev/null +++ b/core/src/test/resources/model/analysis/nullness/nonDominatedBranch2.original.txt @@ -0,0 +1,11 @@ +var @this as this + +$start + @a := invokeStatic `Foo.f()LBar;` + if @a === null then goto $joint else goto $ifNonNull +$ifNonNull + goto $joint +$joint + @c := phi @a from $start, @a from $ifNonNull + @d := @a + return @c \ No newline at end of file