Index: test/mjsunit/regress/regress-4693.js |
diff --git a/test/mjsunit/regress/regress-4693.js b/test/mjsunit/regress/regress-4693.js |
index ed832e65da2b2d0b4a0930d11e39ce24f8bf12e9..614596460758e5982115960e4a58ec23da1e6d67 100644 |
--- a/test/mjsunit/regress/regress-4693.js |
+++ b/test/mjsunit/regress/regress-4693.js |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
// |
-// Flags: --harmony-sloppy-function |
+// Flags: --harmony-sloppy-function --nolegacy-const |
// In sloppy mode we allow function redeclarations within blocks for webcompat. |
(function() { |
@@ -27,3 +27,54 @@ assertThrows(` |
} |
})(); |
`, SyntaxError); |
+ |
+// Conflicts between let and function still throw |
+assertThrows(` |
+ (function() { |
+ if (true) { |
+ let f; |
+ function f() { return 2 } |
+ } |
+ })(); |
+`, SyntaxError); |
+ |
+assertThrows(` |
+ (function() { |
+ if (true) { |
+ function f() { return 2 } |
+ let f; |
+ } |
+ })(); |
+`, SyntaxError); |
+ |
+// Conflicts between const and function still throw |
+assertThrows(` |
+ (function() { |
+ if (true) { |
+ const f; |
+ function f() { return 2 } |
+ } |
+ })(); |
+`, SyntaxError); |
+ |
+assertThrows(` |
+ (function() { |
+ if (true) { |
+ function f() { return 2 } |
+ const f; |
+ } |
+ })(); |
+`, SyntaxError); |
+ |
+// Annex B redefinition semantics still apply with more blocks |
+(function() { |
+ assertEquals(undefined, f); // Annex B |
+ if (true) { |
+ assertEquals(undefined, f); |
+ { function f() { return 1 } } |
+ assertEquals(1, f()); |
+ { function f() { return 2 } } |
+ assertEquals(2, f()); |
+ } |
+ assertEquals(2, f()); // Annex B |
+})(); |