From 14c35739ddb1c0b181d8c54566171f217014b563 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 8 Jan 2020 10:28:10 +0800 Subject: fix corner case in `unsafe_math` (#3677) fixes #3676 --- test/compress/numbers.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test') diff --git a/test/compress/numbers.js b/test/compress/numbers.js index f49996a4..c40ca09d 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -1135,3 +1135,35 @@ issue_3655: { "0", ] } + +issue_3676_1: { + options = { + evaluate: true, + unsafe_math: true, + } + input: { + var a = []; + console.log(false - (a - (a[1] = 42))); + } + expect: { + var a = []; + console.log(false - (a - (a[1] = 42))); + } + expect_stdout: "NaN" +} + +issue_3676_2: { + options = { + evaluate: true, + unsafe_math: true, + } + input: { + var a; + console.log(false - ((a = []) - (a[1] = 42))); + } + expect: { + var a; + console.log(false - ((a = []) - (a[1] = 42))); + } + expect_stdout: "NaN" +} -- cgit v1.2.3