nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: google/closure-compiler
Pull request #1177 (2015-09-29 10:37:31)

Fixes crash on assignment to 'arguments' with SIMPLE_OPTIMIZATIONS.
http://closure-compiler-debugger.appspot.com/#input0%3Dfunction%2520f()%2520%257B%2520arguments%2520%253D%25201%253B%257D%250A%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26COLLAPSE_VARIABLE_DECLARATIONS%3D1

The issue appeared in 8ca04f2ec725e0905a21521954546dc064707e77 (103199949).


Patch:
diff --git a/src/com/google/javascript/jscomp/CollapseVariableDeclarations.java b/src/com/google/javascript/jscomp/CollapseVariableDeclarations.java
index add279c94..13b9a5b11 100644
--- a/src/com/google/javascript/jscomp/CollapseVariableDeclarations.java
+++ b/src/com/google/javascript/jscomp/CollapseVariableDeclarations.java
@@ -215,7 +215,7 @@ class CollapseVariableDeclarations implements CompilerPass {
   }
 
   private static boolean isNamedParameter(Var v) {
-    return v.getParentNode().isParamList();
+    return v.isParam();
   }
 
   private void applyCollapses() {


Test patch:
diff --git a/test/com/google/javascript/jscomp/CollapseVariableDeclarationsTest.java b/test/com/google/javascript/jscomp/CollapseVariableDeclarationsTest.java
index a034664e0..353b1bd96 100644
--- a/test/com/google/javascript/jscomp/CollapseVariableDeclarationsTest.java
+++ b/test/com/google/javascript/jscomp/CollapseVariableDeclarationsTest.java
@@ -87,6 +87,10 @@ public final class CollapseVariableDeclarationsTest extends CompilerTestCase {
          "var a = 1, x, y = 3; x = 5;");
   }
 
+  public void testArgumentsAssignment() {
+    testSame("function f() {arguments = 1;}");
+  }
+
   @Override
   protected CompilerPass getProcessor(Compiler compiler) {
     return new CollapseVariableDeclarations(compiler);
Repository: google/closure-compiler
Pull request #1178 (2015-09-29 23:06:16)

Check for name collisions in CollapseProperties (take 2)
Use 1-base unique ids to avoid conflict with the special case of "$0".


Patch:
diff --git a/src/com/google/javascript/jscomp/CollapseProperties.java b/src/com/google/javascript/jscomp/CollapseProperties.java
index 2de45355a..dd484c3ca 100644
--- a/src/com/google/javascript/jscomp/CollapseProperties.java
+++ b/src/com/google/javascript/jscomp/CollapseProperties.java
@@ -1144,7 +1144,7 @@ class CollapseProperties implements CompilerPass {
       prop = prop.replace("$", "$0");
     }
     String result = root + '$' + prop;
-    int id = 0;
+    int id = 1;
     while (nameMap.containsKey(result)) {
       result = root + '$' + prop + '$' + id;
       id++;


Test patch:
diff --git a/test/com/google/javascript/jscomp/CollapsePropertiesTest.java b/test/com/google/javascript/jscomp/CollapsePropertiesTest.java
index a85f20ab0..9ac418a2e 100644
--- a/test/com/google/javascript/jscomp/CollapsePropertiesTest.java
+++ b/test/com/google/javascript/jscomp/CollapsePropertiesTest.java
@@ -2298,7 +2298,7 @@ public final class CollapsePropertiesTest extends CompilerTestCase {
         LINE_JOINER.join(
             "/** @constructor */ function Funny$Name(){};",
             "function Funny(){};",
-            "var Funny$Name$0 = 5;",
+            "var Funny$Name$1 = 5;",
             "var x = new Funny$Name();"));
 
     test("var ns$x = 0; var ns$x$0 = 1; var ns = {}; ns.x = 8;",
@@ -2308,6 +2308,9 @@ public final class CollapsePropertiesTest extends CompilerTestCase {
          "var ns$x = 0; var ns$x$0 = 1; var ns$x$1 = 2; var ns$x$2 = 8;");
 
     test("var ns$x = {}; ns$x.y = 2; var ns = {}; ns.x = {}; ns.x.y = 8;",
-         "var ns$x$y = 2; var ns$x$0$y = 8;");
+         "var ns$x$y = 2; var ns$x$1$y = 8;");
+
+    test("var ns$x = {}; ns$x.y = 1; var ns = {}; ns.x$ = {}; ns.x$.y = 2; ns.x = {}; ns.x.y = 3;",
+         "var ns$x$y = 1; var ns$x$0$y = 2; var ns$x$1$y = 3;");
   }
 }
Repository: google/closure-compiler
Pull request #1210 (2015-10-14 17:28:48)

Fix issue 1208


Patch:
diff --git a/src/com/google/javascript/jscomp/DefaultPassConfig.java b/src/com/google/javascript/jscomp/DefaultPassConfig.java
index 6eb22e220..f77b86d82 100644
--- a/src/com/google/javascript/jscomp/DefaultPassConfig.java
+++ b/src/com/google/javascript/jscomp/DefaultPassConfig.java
@@ -199,6 +199,11 @@ public final class DefaultPassConfig extends PassConfig {
       checks.add(declaredGlobalExternsOnWindow);
     }
 
+    if (options.getLanguageIn() == LanguageMode.ECMASCRIPT6_TYPED
+            && options.getLanguageOut() != LanguageMode.ECMASCRIPT6_TYPED) {
+      checks.add(convertEs6TypedToEs6);
+    }
+
     checks.add(checkVariableReferences);
 
     if (!options.skipNonTranspilationPasses && options.closurePass) {
@@ -225,11 +230,6 @@ public final class DefaultPassConfig extends PassConfig {
       checks.add(angularPass);
     }
 
-    if (options.getLanguageIn() == LanguageMode.ECMASCRIPT6_TYPED
-        && options.getLanguageOut() != LanguageMode.ECMASCRIPT6_TYPED) {
-      checks.add(convertEs6TypedToEs6);
-    }
-
     if (options.generateExports && !options.skipNonTranspilationPasses) {
       checks.add(generateExports);
     }


Test patch:
diff --git a/test/com/google/javascript/jscomp/Es6TypedIntegrationTest.java b/test/com/google/javascript/jscomp/Es6TypedIntegrationTest.java
index 35d5b2464..82cc4c161 100644
--- a/test/com/google/javascript/jscomp/Es6TypedIntegrationTest.java
+++ b/test/com/google/javascript/jscomp/Es6TypedIntegrationTest.java
@@ -76,6 +76,13 @@ public final class Es6TypedIntegrationTest extends IntegrationTestCase {
         TypeValidator.TYPE_MISMATCH_WARNING);
   }
 
+  public void testVariableDeclaredBeforePassVaraiableReferenceCheck() {
+    test(createCompilerOptions(),
+        "enum A { B, C }\n"
+        + "function b(a:A = A.B) {}\n"
+        + "b();", "");
+  }
+
   @Override
   CompilerOptions createCompilerOptions() {
     CompilerOptions options = new CompilerOptions();
Repository: google/closure-compiler
Pull request #1236 (2015-10-29 14:31:25)

Allow trailing comma in JSDoc record types.
Fixes: #796




dimvar: Looks good, just a couple minor comments. After you do the fixes, please squash the commits and reply here and I'll merge the PR.

Patch:
diff --git a/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java b/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
index 2fc26fc23..b371fcfe1 100644
--- a/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
+++ b/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
@@ -2381,8 +2381,14 @@ public final class JsDocInfoParser {
       // Move to the comma token.
       next();
 
-      // Move to the token passed the comma.
+      // Move to the token past the comma
       skipEOLs();
+
+      if (match(JsDocToken.RIGHT_CURLY)) {
+        // Allow trailing comma (ie, right curly following the comma)
+        break;
+      }
+
       token = next();
     } while (true);
 


Test patch:
diff --git a/test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java b/test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java
index 56e50c471..9296ad749 100644
--- a/test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java
+++ b/test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java
@@ -1147,6 +1147,10 @@ public final class JsDocInfoParserTest extends BaseJSTypeTestCase {
     parseFull("/** @param {{x : function(), 'y'}|function()} n\n*/");
   }
 
+  public void testParseRecordType24() throws Exception {
+    parseFull("/** @param {{a : b, c,}} n\n*/");
+  }
+
   public void testParseParamError1() throws Exception {
     parseFull("/** @param\n*/",
         "Bad type annotation. expecting a variable name in a @param tag");