PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: jquense/yup (ts)

Issue:
Wrong path in ValidationError when validating an object with dotted keys
When validating an object with dotted keys (e.g. `{foo: {'bar.baz': 'zot'}}`) any thrown ValidationErrors will have a `path` that can't be used with things like lodash's `get`, and that will confuse e.g. Formik's error handling.

Example here: https://runkit.com/espenhw/5ce6a57a7e042f001a056407 - I'd like the `path` on the ValidationError to be `a["b.c"]`.

Pull request:
Use the alternate object index path syntax if the key contains dots
This fixes #536 by switching to the `foo.bar["baz"]` syntax if the key contains a dot.

Alternatively, that syntax could be used unconditionally; I chose not to so as to keep the path pretty when possible.

There are, of course, other characters that would break the path syntax, e.g. square brackets and quotes.  The current approach would work for anything but double quotes; I'm not familiar enough with lodash's path syntax to come up with something that would always work.

Patch:
diff --git a/src/object.js b/src/object.js
index fdd5110..c624cb4 100644
--- a/src/object.js
+++ b/src/object.js
@@ -146,7 +146,10 @@ inherits(ObjectSchema, MixedSchema, {
         originalValue = originalValue || value;
 
         let validations = this._nodes.map(key => {
-          let path = makePath`${opts.path}.${key}`;
+          let path =
+            key.indexOf('.') === -1
+              ? makePath`${opts.path}.${key}`
+              : makePath`${opts.path}["${key}"]`;
           let field = this.fields[key];
 
           let innerOptions = {


Test patch:
diff --git a/test/object.js b/test/object.js
index 705067f..35db472 100644
--- a/test/object.js
+++ b/test/object.js
@@ -504,6 +504,27 @@ describe('Object types', () => {
       }
     });
 
+    it('should set the correct path with dotted keys', async () => {
+      let inst = object({
+        'dotted.str': string()
+          .required()
+          .nullable(),
+        nested: lazy(() => inst.default(undefined)),
+      });
+
+      let value = {
+        nested: { 'dotted.str': null },
+        'dotted.str': 'foo',
+      };
+
+      try {
+        await inst.validate(value, { strict: true });
+      } catch (err) {
+        err.path.should.equal('nested["dotted.str"]');
+        err.message.should.match(/required/);
+      }
+    });
+
     it('should resolve array sub types', async () => {
       let inst = object({
         str: string()
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 289
Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

The game of Nim is played as follows. Starting with three heaps, each containing a variable number of items, two players take turns removing one or more items from a single pile. The player who eventually is forced to take the last stone loses. For example, if the initial heap sizes are 3, 4, and 5, a game could be played as shown below:
```
  A  |  B  |  C
-----------------
  3  |  4  |  5
  3  |  1  |  3
  3  |  1  |  3
  0  |  1  |  3
  0  |  1  |  0
  0  |  0  |  0 
```
In other words, to start, the first player takes three items from pile B. The second player responds by removing two stones from pile C. The game continues in this way until player one takes last stone and loses.

Given a list of non-zero starting values `[a, b, c]`, and assuming optimal play, determine whether the first player has a forced win.

Pull request:
Day289
Resolves #593.

Patch:
diff --git a/README.md b/README.md
index fe4c781..c05c33b 100644
--- a/README.md
+++ b/README.md
@@ -300,6 +300,7 @@ problems from
 * [Day 286](https://github.com/vaskoz/dailycodingproblem-go/issues/585)
 * [Day 287](https://github.com/vaskoz/dailycodingproblem-go/issues/587)
 * [Day 288](https://github.com/vaskoz/dailycodingproblem-go/issues/590)
+* [Day 289](https://github.com/vaskoz/dailycodingproblem-go/issues/593)
 * [Day 290](https://github.com/vaskoz/dailycodingproblem-go/issues/594)
 * [Day 291](https://github.com/vaskoz/dailycodingproblem-go/issues/596)
 * [Day 292](https://github.com/vaskoz/dailycodingproblem-go/issues/598)
diff --git a/day289/problem.go b/day289/problem.go
new file mode 100644
index 0000000..f18c801
--- /dev/null
+++ b/day289/problem.go
@@ -0,0 +1,13 @@
+package day289
+
+// CanFirstPlayerForceWinNimGame answers if the first player
+// can force a win with the given heap configuration.
+func CanFirstPlayerForceWinNimGame(heaps []int) bool {
+	sum := 0
+
+	for _, heap := range heaps {
+		sum ^= heap
+	}
+
+	return sum != 0
+}


Test patch:
diff --git a/day289/problem_test.go b/day289/problem_test.go
new file mode 100644
index 0000000..b57990a
--- /dev/null
+++ b/day289/problem_test.go
@@ -0,0 +1,35 @@
+package day289
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	heaps     []int
+	forcedWin bool
+}{
+	{[]int{3, 4, 5}, true},
+	{[]int{1, 2, 3}, false},
+	{[]int{1, 4, 5}, false},
+	{[]int{1, 6, 7}, false},
+	{[]int{5, 9, 12}, false},
+	{[]int{1, 2, 4, 7}, false},
+	{[]int{1, 2, 4, 6}, true},
+}
+
+func TestCanFirstPlayerForceWinNimGame(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if res := CanFirstPlayerForceWinNimGame(tc.heaps); res != tc.forcedWin {
+			t.Errorf("Expected %v, got %v", tc.forcedWin, res)
+		}
+	}
+}
+
+func BenchmarkCanFirstPlayerForceWinNimGame(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			CanFirstPlayerForceWinNimGame(tc.heaps)
+		}
+	}
+}
Repository: jlongster/prettier (js)

Issue:
Unprinted comment in object destructuring
```js
const {a /* missing comment */ = 1} = b
```

```
Error: Comment "missing comment" was not printed. Please report this error!
```

https://jlongster.github.io/prettier/#%7B%22content%22%3A%22const%20%7Ba%20%2F*%20missing%20comment%20*%2F%20%3D%201%7D%20%3D%20b%5Cn%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3Afalse%2C%22bracketSpacing%22%3Atrue%2C%22jsxBracketSameLine%22%3Afalse%2C%22doc%22%3Afalse%7D%7D

Pull request:
Fix missing comments in assignment pattern
This PR should fix #699.

Patch:
diff --git a/src/comments.js b/src/comments.js
index d2f1f99f9..c630afa31 100644
--- a/src/comments.js
+++ b/src/comments.js
@@ -179,7 +179,8 @@ function attach(comments, ast, text) {
         addDanglingComment(ast, comment);
       }
     } else {
-      if (handleIfStatementComments(enclosingNode, followingNode, comment)) {
+      if (handleIfStatementComments(enclosingNode, followingNode, comment) ||
+          handleObjectProperty(enclosingNode, precedingNode, comment)) {
         // We're good
       } else if (precedingNode && followingNode) {
         // Otherwise, text exists both before and after the comment on
@@ -395,6 +396,19 @@ function handleConditionalExpressionComments(
   return false;
 }
 
+function handleObjectProperty(enclosingNode, precedingNode, comment) {
+  if (enclosingNode &&
+      (enclosingNode.type === "ObjectProperty" ||
+       enclosingNode.type === "Property") &&
+      enclosingNode.shorthand &&
+      enclosingNode.key === precedingNode &&
+      enclosingNode.value.type === "AssignmentPattern") {
+    addTrailingComment(enclosingNode.value.left, comment);
+    return true;
+  }
+  return false;
+}
+
 function printComment(commentPath) {
   const comment = commentPath.getValue();
   comment.printed = true;


Test patch:
diff --git a/tests/comments/__snapshots__/jsfmt.spec.js.snap b/tests/comments/__snapshots__/jsfmt.spec.js.snap
index 1c50b6e53..e300d1965 100644
--- a/tests/comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/comments/__snapshots__/jsfmt.spec.js.snap
@@ -1087,3 +1087,25 @@ try {
 }
 "
 `;
+
+exports[`test assignment-pattern.js 1`] = `
+"const { a /* comment */ = 1 } = b;
+
+const { c = 1 /* comment */ } = d;
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+const { a /* comment */ = 1 } = b;
+
+const { c = 1 /* comment */ } = d;
+"
+`;
+
+exports[`test assignment-pattern.js 2`] = `
+"const { a /* comment */ = 1 } = b;
+
+const { c = 1 /* comment */ } = d;
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+const { a /* comment */ = 1 } = b;
+
+const { c = 1 /* comment */ } = d;
+"
+`;
diff --git a/tests/comments/assignment-pattern.js b/tests/comments/assignment-pattern.js
new file mode 100644
index 000000000..52e0544c7
--- /dev/null
+++ b/tests/comments/assignment-pattern.js
@@ -0,0 +1,3 @@
+const { a /* comment */ = 1 } = b;
+
+const { c = 1 /* comment */ } = d;
Repository: hyrodium/BasicBSpline.jl (julia)

Issue:
Strange `issqsubset` behavior
I believe there were some issues like this before.
```julia
julia> using BasicBSpline

julia> P1 = BSplineSpace{3}(KnotVector([2, 2, 2, 3, 3, 4, 4, 4]))
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([2, 2, 2, 3, 3, 4, 4, 4]))

julia> P2 = BSplineSpace{3}(KnotVector([1, 3, 3, 3, 4]))
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 3, 3, 3, 4]))

julia> dim(P1)
4

julia> dim(P2)
1

julia> P1 ⊑ P2  # shuold be false
true
```

Pull request:
This PR fixes #329.

Patch:
diff --git a/src/_BSplineSpace.jl b/src/_BSplineSpace.jl
index c7c8f28a1..cbb5c20ba 100644
--- a/src/_BSplineSpace.jl
+++ b/src/_BSplineSpace.jl
@@ -184,6 +184,11 @@ function issqsubset(P::BSplineSpace{p}, P′::BSplineSpace{p′}) where {p, p′
     if p₊ < 0
         return false
     elseif domain(P) ≠ domain(P′)
+        # The domains must be equal for P ⊑ P′.
+        return false
+    elseif !(k′[1+p′] < k′[end-p′])
+        # The width(domain(P′)) must be non-zero for P ⊑ P′.
+        # There may be some edge-case like P′ ⊑ P′, but we don't need `true` for that situation.
         return false
     end
 


Test patch:
diff --git a/test/test_BSplineSpace.jl b/test/test_BSplineSpace.jl
index 6f316a678..2402a0b4e 100644
--- a/test/test_BSplineSpace.jl
+++ b/test/test_BSplineSpace.jl
@@ -102,6 +102,17 @@
         @test P3 ⊋ P1
     end
 
+    @testset "sqsubset" begin
+        P1 = BSplineSpace{3}(KnotVector([2, 2, 2, 3, 3, 4, 4, 4]))
+        P2 = BSplineSpace{3}(KnotVector([1, 3, 3, 3, 4]))
+        P3 = BSplineSpace{2}(knotvector"3 3")
+        P4 = BSplineSpace{3}(knotvector"4 4")
+        P5 = BSplineSpace{3}(knotvector"414")
+
+        @test P1 ⋢ P2
+        @test P3 ⊑ P4 ⊑ P5
+    end
+
     @testset "equality" begin
         P1 = BSplineSpace{2}(KnotVector([1, 2, 3, 5, 8, 8, 9]))
         P2 = BSplineSpace{2}(KnotVector([1, 2, 3, 5, 8, 8, 9]))
Repository: tannerlinsley/react-query (ts)

Issue:
queries retrying even though option is set to false
**Describe the bug**

While upgrading to v2 I noticed that some tests broke because `useQuery` does no longer use the config from the provider when you prefetch.

**To Reproduce**

Steps to reproduce the behavior:

1. Go to https://codesandbox.io/s/sweet-resonance-zu0em?file=/src/App.js
2. Check the console
4. See multiple logs from react-query trying to retry even though the option is set to `false`

**Expected behavior**

Queries does not retry if option is set to `false`

**Screenshots**
N/A

**Desktop (please complete the following information):**
N/A

**Smartphone (please complete the following information):**
N/A

**Additional context**
N/A


Pull request:
fix:(prefetchQuery): override default retry behaviour to false
Fix #652 

Patch:
diff --git a/src/core/queryCache.js b/src/core/queryCache.js
index 4b34fc0f2..813b7ef47 100644
--- a/src/core/queryCache.js
+++ b/src/core/queryCache.js
@@ -208,6 +208,9 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
 
     let [queryKey, config, { force, throwOnError } = {}] = getQueryArgs(args)
 
+    // https://github.com/tannerlinsley/react-query/issues/652
+    config = { retry: false, ...config }
+
     try {
       const query = queryCache.buildQuery(queryKey, config)
       if (force || query.state.isStale) {


Test patch:
diff --git a/src/core/tests/queryCache.test.js b/src/core/tests/queryCache.test.js
index 9868fef23..74feba9ed 100644
--- a/src/core/tests/queryCache.test.js
+++ b/src/core/tests/queryCache.test.js
@@ -23,6 +23,20 @@ describe('queryCache', () => {
     ).not.toThrow()
   })
 
+  // https://github.com/tannerlinsley/react-query/issues/652
+  test('prefetchQuery should not retry by default', async () => {
+    await expect(
+      queryCache.prefetchQuery(
+        'key',
+        async () => {
+          throw new Error('error')
+        },
+        {},
+        { throwOnError: true }
+      )
+    ).rejects.toEqual(new Error('error'))
+  })
+
   test('prefetchQuery returns the cached data on cache hits', async () => {
     const fetchFn = () => Promise.resolve('data')
     const first = await queryCache.prefetchQuery('key', fetchFn)