Bug 1275240 - Fix the type of parameter redeclaration from TypeError to SyntaxError. r=shu
authorTooru Fujisawa <arai_a@mac.com>
Thu, 26 May 2016 01:26:35 +0900
changeset 371094 97d4fa9f099b14a98d4242f1c73507beb1f70081
parent 371093 dca0aaaa1f59bfd84c1daabc21663cb7604cd76a
child 371095 045768176a0b6d39b94d63c6c5d15b78f84050bf
push id19232
push userbmo:gps@mozilla.com
push dateWed, 25 May 2016 22:36:54 +0000
reviewersshu
bugs1275240
milestone49.0a1
Bug 1275240 - Fix the type of parameter redeclaration from TypeError to SyntaxError. r=shu
js/src/js.msg
js/src/tests/js1_8_1/regress/regress-452498-092.js
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -291,17 +291,17 @@ MSG_DEF(JSMSG_PAREN_BEFORE_CATCH,      0
 MSG_DEF(JSMSG_PAREN_BEFORE_COND,       0, JSEXN_SYNTAXERR, "missing ( before condition")
 MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL,     0, JSEXN_SYNTAXERR, "missing ( before formal parameters")
 MSG_DEF(JSMSG_PAREN_BEFORE_SWITCH,     0, JSEXN_SYNTAXERR, "missing ( before switch expression")
 MSG_DEF(JSMSG_PAREN_BEFORE_WITH,       0, JSEXN_SYNTAXERR, "missing ( before with-statement object")
 MSG_DEF(JSMSG_PAREN_IN_PAREN,          0, JSEXN_SYNTAXERR, "missing ) in parenthetical")
 MSG_DEF(JSMSG_RC_AFTER_EXPORT_SPEC_LIST, 0, JSEXN_SYNTAXERR, "missing '}' after export specifier list")
 MSG_DEF(JSMSG_RC_AFTER_IMPORT_SPEC_LIST, 0, JSEXN_SYNTAXERR, "missing '}' after module specifier list")
 MSG_DEF(JSMSG_REDECLARED_CATCH_IDENTIFIER, 1, JSEXN_SYNTAXERR, "redeclaration of identifier '{0}' in catch")
-MSG_DEF(JSMSG_REDECLARED_PARAM,        1, JSEXN_TYPEERR, "redeclaration of formal parameter {0}")
+MSG_DEF(JSMSG_REDECLARED_PARAM,        1, JSEXN_SYNTAXERR, "redeclaration of formal parameter {0}")
 MSG_DEF(JSMSG_RESERVED_ID,             1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
 MSG_DEF(JSMSG_REST_WITH_DEFAULT,       0, JSEXN_SYNTAXERR, "rest parameter may not have a default")
 MSG_DEF(JSMSG_SELFHOSTED_TOP_LEVEL_LEXICAL, 1, JSEXN_SYNTAXERR, "self-hosted code cannot contain top-level {0} declarations")
 MSG_DEF(JSMSG_SELFHOSTED_UNBOUND_NAME, 0, JSEXN_TYPEERR, "self-hosted code may not contain unbound name lookups")
 MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND,     0, JSEXN_SYNTAXERR, "missing ; after for-loop condition")
 MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT,     0, JSEXN_SYNTAXERR, "missing ; after for-loop initializer")
 MSG_DEF(JSMSG_SEMI_BEFORE_STMNT,       0, JSEXN_SYNTAXERR, "missing ; before statement")
 MSG_DEF(JSMSG_SOURCE_TOO_LONG,         0, JSEXN_RANGEERR, "source is too long")
--- a/js/src/tests/js1_8_1/regress/regress-452498-092.js
+++ b/js/src/tests/js1_8_1/regress/regress-452498-092.js
@@ -17,24 +17,24 @@ test();
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
 // ------- Comment #92 From Jesse Ruderman
 
-  expect = 'TypeError: redeclaration of formal parameter e';
+  expect = 'SyntaxError: redeclaration of formal parameter e';
   try
   {
     eval('(function (e) { var e; const e = undefined; });');
   }
   catch(ex)
   {
     actual = ex + '';
   }
-// Without patch: "TypeError: redeclaration of var e"
-// expected new behavior // With patch:    "TypeError: redeclaration of formal parameter e:"
+// Without patch: "SyntaxError: redeclaration of var e"
+// expected new behavior // With patch:    "SyntaxError: redeclaration of formal parameter e:"
 
   reportCompare(expect, actual, summary);
 
   exitFunc ('test');
 }