PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 184
Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

Given n numbers, find the greatest common denominator between them.

For example, given the numbers `[42, 56, 14]`, return `14`.

Pull request:
Day184
Resolves #378.

Patch:
diff --git a/README.md b/README.md
index 458c781..081950b 100644
--- a/README.md
+++ b/README.md
@@ -191,3 +191,4 @@ problems from
 * [Day 178](https://github.com/vaskoz/dailycodingproblem-go/issues/367)
 * [Day 179](https://github.com/vaskoz/dailycodingproblem-go/issues/371)
 * [Day 180](https://github.com/vaskoz/dailycodingproblem-go/issues/373)
+* [Day 184](https://github.com/vaskoz/dailycodingproblem-go/issues/378)
diff --git a/day184/problem.go b/day184/problem.go
new file mode 100644
index 0000000..2570219
--- /dev/null
+++ b/day184/problem.go
@@ -0,0 +1,21 @@
+package day184
+
+// GcdSlice returns the greatest common denominator
+// of all the values in the slice.
+func GcdSlice(nums []int) int {
+	if len(nums) == 0 {
+		return 0
+	}
+	result := nums[0]
+	for i := 1; i < len(nums); i++ {
+		result = gcd(nums[i], result)
+	}
+	return result
+}
+
+func gcd(a, b int) int {
+	if a == 0 {
+		return b
+	}
+	return gcd(b%a, a)
+}


Test patch:
diff --git a/day184/problem_test.go b/day184/problem_test.go
new file mode 100644
index 0000000..6138d82
--- /dev/null
+++ b/day184/problem_test.go
@@ -0,0 +1,30 @@
+package day184
+
+import "testing"
+
+var testcases = []struct {
+	nums     []int
+	expected int
+}{
+	{[]int{42, 56, 14}, 14},
+	{[]int{14}, 14},
+	{nil, 0},
+	{[]int{}, 0},
+}
+
+func TestGcdSlice(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := GcdSlice(tc.nums); result != tc.expected {
+			t.Errorf("Expected %v, got %v for input %v", tc.expected, result, tc.nums)
+		}
+	}
+}
+
+func BenchmarkGcdSlice(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			GcdSlice(tc.nums)
+		}
+	}
+}
Repository: babel/babili (js)

Issue:
Don't use path.replaceWith() with a source string, use path.replaceWithSourceString()
ERROR in unknown: Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`

Seems to be the result of this change : 
https://github.com/babel/babili/pull/543/files

Pull request:
Fix #576
People were calling `"foo".toString()` or `["foo", "bar"].toString()`, which returned the real JS string `"[object Object]"`, the stringified version of the replacements object. Fixes #576.

---

I just noticed this:
```js
[foo, bar].toString() // is longer than
[foo, bar].join(',')
```

Patch:
diff --git a/packages/babel-plugin-minify-constant-folding/src/index.js b/packages/babel-plugin-minify-constant-folding/src/index.js
index 782d76b..da5b16e 100644
--- a/packages/babel-plugin-minify-constant-folding/src/index.js
+++ b/packages/babel-plugin-minify-constant-folding/src/index.js
@@ -22,7 +22,10 @@ function swap(path, member, handlers, ...args) {
   const key = getName(member);
   if (key === undefined) return;
   let handler = handlers[key];
-  if (typeof handler !== "function") {
+  if (
+    typeof handler !== "function" ||
+    !Object.hasOwnProperty.call(handlers, key)
+  ) {
     if (typeof handlers[FALLBACK_HANDLER] === "function") {
       handler = handlers[FALLBACK_HANDLER].bind(member.object, key);
     } else {


Test patch:
diff --git a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
index ca2e633..352027f 100644
--- a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
+++ b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
@@ -237,4 +237,18 @@ describe("constant-folding-plugin", () => {
     );
     expect(transform(source)).toBe(expected);
   });
+
+  it("shouldn’t crash on toString() calls or accesses", () => {
+    const source = unpad(
+      `
+      "foo".toString();
+      ["foo", "bar"].toString();
+      ({}).toString();
+      "foo".toString;
+      ["foo", "bar"].toString;
+      ({}).toString;
+      `
+    );
+    expect(transform(source)).toBe(source);
+  });
 });
Repository: phpactor/phpactor (php)

Issue:
Crash when try to fill object
```php
<?php

use App\Entity\Tag;

$tag = new Tag<>
```

```
[Error - 5:32:30 pm] Request textDocument/codeAction failed.
  Message: Exception [Error] Call to a member function getEndPosition() on null at /home/gingdev/code/gingdev/phpactor/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php#110
```

Pull request:
Gh 1833 Support parenthsis in fill object
Fixes #1833 support adding parenthesis 

Patch:
diff --git a/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php b/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
index 85d30af4..fc88484a 100644
--- a/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
+++ b/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
@@ -107,7 +107,19 @@ class WorseFillObject implements FillObject
             $sourceCode->use($import->__toString());
         }
         $textEdits = $this->updater->textEditsFor($sourceCode->build(), Code::fromString($document->__toString()));
-        $textEdits = $textEdits->add(TextEdit::create($node->openParen->getEndPosition(), 0, implode(', ', $args)));
+
+        $openParen = $closedParen = '';
+        if ($node->openParen) {
+            $endPosition = $node->openParen->getEndPosition();
+        } else {
+            $endPosition = $node->getEndPosition();
+            $openParen = '(';
+        }
+        if (!$node->closeParen) {
+            $closedParen = ')';
+        }
+
+        $textEdits = $textEdits->add(TextEdit::create($endPosition, 0, sprintf('%s%s%s', $openParen, implode(', ', $args), $closedParen)));
 
         return $textEdits;
     }


Test patch:
diff --git a/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test b/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test
new file mode 100644
index 00000000..9f014c3c
--- /dev/null
+++ b/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test
@@ -0,0 +1,27 @@
+// File: source
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DT<>O;
+// File: expected
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DTO(one: '');
+// File: nonamed
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DTO('' /** $one string */);
Repository: denoland/deno_core (rust)

Issue:
Enable Temporal API by default
Working on https://github.com/denoland/deno/pull/22134 I had to pass a V8 flag on startup to enable Temporal API (I then conditionally remove it from global scope on startup if appropriate unstable is not provided). The problem is that Temporal won't be available in the snapshot and will probably cause a slowdown on startup.

We should enable Temporal by default in `deno_core` by passing `--harmony-temporal` flag in:
https://github.com/denoland/deno_core/blob/b326a2188e7b0eb71830377459b46fb5d0441fd8/core/runtime/setup.rs#L24-L32

Then a simple test that checks for presence of `Temporal` global will be needed:
```rust
runtime.execute_script("test.js", r#"if (typeof Temporal === "undefined") throw new Error()"#)
```

Pull request:
fix: Enable the Temporal API proposal by default
Fixes #641 

Patch:
diff --git a/core/runtime/setup.rs b/core/runtime/setup.rs
index 94f2411..dbe9b0c 100644
--- a/core/runtime/setup.rs
+++ b/core/runtime/setup.rs
@@ -29,6 +29,7 @@ fn v8_init(
     " --turbo_fast_api_calls",
     " --harmony-array-from_async",
     " --harmony-iterator-helpers",
+    " --harmony-temporal",
   );
   let predictable_flags = "--predictable --random-seed=42";
   let expose_natives_flags = "--expose_gc --allow_natives_syntax";


Test patch:
diff --git a/testing/unit/tc39_test.ts b/testing/unit/tc39_test.ts
index d4a8785..841c81d 100644
--- a/testing/unit/tc39_test.ts
+++ b/testing/unit/tc39_test.ts
@@ -1,5 +1,5 @@
 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-import { fail, test } from "checkin:testing";
+import { assert, fail, test } from "checkin:testing";
 
 // Verify that "array by copy" proposal is enabled (https://github.com/tc39/proposal-change-array-by-copy)
 test(function testArrayByCopy() {
@@ -38,3 +38,9 @@ test(function testIteratorHelpers() {
     fail("failed");
   }
 });
+
+// Verify that the "Temporal" proposal is enabled
+test(function testTemporalEnabled() {
+  // @ts-expect-error: Not available in TypeScript yet
+  assert(typeof Temporal !== "undefined");
+});