nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: solidjs-community/solid-primitives
Pull request #734 (2025-01-10 08:50:32)

fix: static-store setValue with setterFn has correct arguments
if a key is not listened to, setValue on that key incorrectly wraps the prev value in an array when passed as argument to a setterFn

```
const [state, setState] = createStaticStore({a: 1});
setState('a', prev => prev + 1); // prev is `[1]`, should be `1`
```


Patch:
diff --git a/.changeset/silent-paws-approve.md b/.changeset/silent-paws-approve.md
new file mode 100644
index 00000000..f5eca98e
--- /dev/null
+++ b/.changeset/silent-paws-approve.md
@@ -0,0 +1,5 @@
+---
+"@solid-primitives/static-store": patch
+---
+
+fix: static-store setValue with setterFn has correct arguments
diff --git a/packages/static-store/src/index.ts b/packages/static-store/src/index.ts
index fb8b652d..ae91fcaf 100644
--- a/packages/static-store/src/index.ts
+++ b/packages/static-store/src/index.ts
@@ -68,7 +68,7 @@ export function createStaticStore<T extends object>(
   const setValue = (key: keyof T, value: SetterParam<any>): void => {
     const signal = cache[key];
     if (signal) return signal[1](value);
-    if (key in copy) copy[key] = accessWith(value, [copy[key]]);
+    if (key in copy) copy[key] = accessWith(value, copy[key]);
   };
 
   return [


Test patch:
diff --git a/packages/static-store/test/index.test.ts b/packages/static-store/test/index.test.ts
index 23f17903..6e831990 100644
--- a/packages/static-store/test/index.test.ts
+++ b/packages/static-store/test/index.test.ts
@@ -32,6 +32,9 @@ describe("createStaticStore", () => {
         d: [0, 1, 2],
       });
 
+      setState('a', prev => prev + 1);
+      expect(state.a).toBe(10);
+
       createEffect(() => {
         state.a;
         aUpdates++;
Repository: solidjs-community/solid-primitives
Pull request #781 (2025-03-26 13:03:53)

Fix create deep signal
The setter of `createDeepSignal` is not working if you pass a non-function value.

```ts
const [data, { mutate }] = createResource(() => ({ counter: 1 }), {
  storage: createDeepSignal,
});
// mutate(() => ({ counter: 2 })); // works
mutate({ counter: 2 }); // not working
createEffect(() => {
  console.log(data()?.counter); // 1
});
```


Patch:
diff --git a/.changeset/small-coats-obey.md b/.changeset/small-coats-obey.md
new file mode 100644
index 00000000..1c0211cf
--- /dev/null
+++ b/.changeset/small-coats-obey.md
@@ -0,0 +1,5 @@
+---
+"@solid-primitives/resource": patch
+---
+
+Fix setter input value in `createDeepSignal`.
diff --git a/packages/resource/src/index.ts b/packages/resource/src/index.ts
index b5da335e..9faa3cfc 100644
--- a/packages/resource/src/index.ts
+++ b/packages/resource/src/index.ts
@@ -298,7 +298,8 @@ export function createDeepSignal<T>(v?: T): Signal<T> {
   return [
     () => store[0],
     (update: T) => (
-      setStore(0, reconcile(typeof update === "function" ? update(unwrap(store[0])) : v)), store[0]
+      setStore(0, reconcile(typeof update === "function" ? update(unwrap(store[0])) : update)),
+      store[0]
     ),
   ] as Signal<T>;
 }


Test patch:
diff --git a/packages/resource/test/index.test.ts b/packages/resource/test/index.test.ts
index 6849b7ee..4974ee00 100644
--- a/packages/resource/test/index.test.ts
+++ b/packages/resource/test/index.test.ts
@@ -419,4 +419,26 @@ describe("createDeepSignal", () => {
         return run + 1;
       });
     }));
+  test("mutates the resource with callback", () =>
+    testEffect(done => {
+      const [data, { mutate }] = createResource(() => ({ counter: 1 }), {
+        storage: createDeepSignal,
+      });
+      mutate(() => ({ counter: 2 }));
+      createEffect(() => {
+        expect(data()?.counter).toBe(2);
+        done();
+      });
+    }));
+  test("mutates the resource with plain object", () =>
+    testEffect(done => {
+      const [data, { mutate }] = createResource(() => ({ counter: 1 }), {
+        storage: createDeepSignal,
+      });
+      mutate({ counter: 2 });
+      createEffect(() => {
+        expect(data()?.counter).toBe(2);
+        done();
+      });
+    }));
 });
Repository: shazow/whatsabi
Pull request #143 (2024-10-16 20:31:56)

Handle multiple detected FixedProxyResolver better
Re: #142 


Patch:
diff --git a/examples/resolveproxy.ts b/examples/resolveproxy.ts
index 35ec454..b3581b9 100755
--- a/examples/resolveproxy.ts
+++ b/examples/resolveproxy.ts
@@ -33,8 +33,10 @@ async function main() {
         }
     }
 
+    console.log("Detected proxies: ", program.proxies);
+
     for (const resolver of program.proxies) {
-        console.log("Proxy found:", resolver.toString());
+        console.log("Resolving proxy:", resolver.toString());
 
         if (!selector && resolver instanceof DiamondProxyResolver) {
             const facets = await (resolver as DiamondProxyResolver).facets(provider, address);
diff --git a/src/disasm.ts b/src/disasm.ts
index 9aa82db..bd2269b 100644
--- a/src/disasm.ts
+++ b/src/disasm.ts
@@ -277,7 +277,10 @@ export function disasm(bytecode: string, config?: {onlyJumpTable: boolean}): Pro
                     val.slice(val.length-20), // Might be padded with zeros
                     20,
                 );
-                p.proxies.push(new FixedProxyResolver("HardcodedDelegateProxy", addr));
+                // Check if proxy is already found. Rare to have more than 1, so we'll just O(N) here
+                if (!p.proxies.find(p => p instanceof FixedProxyResolver && p.resolvedAddress === addr)) {
+                    p.proxies.push(new FixedProxyResolver("HardcodedDelegateProxy", addr));
+                }
 
             } else if (
                 code.at(-3) === opcodes.SLOAD &&


Test patch:
diff --git a/src/__tests__/proxies.test.ts b/src/__tests__/proxies.test.ts
index 11314ca..a4fc8fa 100644
--- a/src/__tests__/proxies.test.ts
+++ b/src/__tests__/proxies.test.ts
@@ -219,3 +219,20 @@ describe('proxy internal slot reading', () => {
         expect(got.length).to.not.equal(0);
     });
 });
+
+
+describe('multiple proxy resolving', () => {
+    cached_test('resolve WeightedRateSetCollectionPool', async ({ withCache, provider }) => {
+        const address = "0x56C5Aef1296d004707475c8440f540DdA409b53D";
+        const code = await withCache(
+            `${address}_code`,
+            async () => {
+                return await provider.getCode(address)
+            },
+        );
+        const program = disasm(code);
+
+        expect(program.proxies.length).to.be.equal(4);
+    });
+
+});
Repository: shepherdwind/velocity.js
Pull request #52 (2015-10-28 16:47:39)

error rendering values as a result of a string function.
If we define as vm that assigns the result of a string function, the render method fails stating this error:

     TypeError: Cannot assign to read only property 'eval' of monica

This happens on references.js, in the getPropMethod. Line 273, when trying to set baseRef.eval property.

This test case highlights the issue.

Other information

node versions I see the issue present itself:
v4.2.1
v3.3.0

It does not seem to happen with node version 0.10.25. Maybe it's a bit more lax regarding this kind of attribution?

Maybe this pull request can help fix the code. I'll take a look at it as well, but I imagine you guys would know best.


Patch:
diff --git a/src/compile/references.js b/src/compile/references.js
index 5784cbf..643cca2 100644
--- a/src/compile/references.js
+++ b/src/compile/references.js
@@ -270,9 +270,11 @@ module.exports = function(Velocity, utils) {
 
           var that = this;
 
-          baseRef.eval = function() {
-            return that.eval.apply(that, arguments);
-          };
+          if(typeof baseRef === 'object'){
+            baseRef.eval = function() {
+              return that.eval.apply(that, arguments);
+            };
+          }
 
           try {
             ret = ret.apply(baseRef, args);


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index 4c18a04..1a09958 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -206,6 +206,20 @@ describe('Compile', function() {
       assert.equal("monica", getContext(vm).monkey.Friend)
       assert.equal("123", getContext(vm).monkey.Number)
     })
+    
+    it('set equal to result of method ', function () {
+      var vm = "#set( $monkey = 'monica' ) ## string literal\n" +
+               '#set( $result = $monkey.substring(1) ) ##calling method'
+      assert.equal("monica", getContext(vm).monkey)
+      assert.equal("onica", getContext(vm).result)
+    })
+
+    it('set equal to result of method ', function () {
+      var vm = "#set( $monkey = 1234 ) ## number literal\n" +
+               '#set( $result = $monkey.toString() ) ##calling method'
+      assert.equal("1234", getContext(vm).monkey)
+      assert.equal("1234", getContext(vm).result)
+    })
 
     it('equal to method/property reference', function() {
       var vm = "#set($monkey.Blame = $spindoctor.Leak) ## property \n" +
Repository: shepherdwind/velocity.js
Pull request #57 (2015-12-15 04:30:58)

fix: toString rewrite only when toString equal function { [native code]}


Patch:
diff --git a/.npmignore b/.npmignore
index f2db655..aac3de7 100644
--- a/.npmignore
+++ b/.npmignore
@@ -2,6 +2,8 @@
 .gitignore
 .rvmrc
 Makefile
-tests/runner/*
-examples/*
-build/*
+examples
+coverage
+build
+dist
+tests
diff --git a/src/compile/compile.js b/src/compile/compile.js
index 36c1675..d881d78 100644
--- a/src/compile/compile.js
+++ b/src/compile/compile.js
@@ -113,8 +113,8 @@ module.exports = function(Velocity, utils) {
       }
 
       if (utils.isObject(value)) {
-        if (value.hasOwnProperty('toString')) {
-          return value.toString();
+        if (value.toString.toString().indexOf('[native code]') === -1) {
+          return value;
         }
 
         var kvJoin = function(k) { return k + "=" + this.format(value[k]); }.bind(this);


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index 988799f..d72b5f6 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -714,7 +714,12 @@ describe('Compile', function() {
 
     it('$control.setTemplate', function() {
 
-      var control = {
+      var Control = function() {
+        this.__temp = {};
+      };
+
+      Control.prototype = {
+        constructor: Control,
 
         setTemplate: function(vm) {
 
@@ -723,9 +728,9 @@ describe('Compile', function() {
 
         },
         toString: function() {
+          debugger;
           return this.eval(this.vm, this.__temp);
         },
-        __temp: {},
         setParameter: function(key, value) {
           this.__temp[key] = value;
           return this;
@@ -737,7 +742,7 @@ describe('Compile', function() {
       var vm = '$control.setTemplate($str).setParameter("who", "Blob")' +
       '.setParameter("where", "China")'
       var expected = 'hello Blob, welcome to China';
-      assert.equal(render(vm, {str: str, control: control}), expected)
+      assert.equal(render(vm, {str: str, control: new Control()}), expected)
 
     })
Repository: shepherdwind/velocity.js
Pull request #83 (2017-04-14 11:25:00)

fix: keep newline after unparse block
fix https://github.com/shepherdwind/velocity.js/pull/82


Patch:
diff --git a/src/parse.js b/src/parse.js
index a122941..b5df65d 100644
--- a/src/parse.js
+++ b/src/parse.js
@@ -28,7 +28,8 @@ var parse = function(str, blocks, ignoreSpace) {
    */
   ignoreSpace || utils.forEach(asts, function trim(ast, i) {
     var TRIM_REG = /^[ \t]*\n/;
-    if (ast.type && ast.type !== 'references') {
+    // after raw and references, then keep the newline.
+    if (ast.type && ['references', 'raw'].indexOf(ast.type) === -1) {
       var _ast = asts[i + 1];
       if (typeof _ast === 'string' && TRIM_REG.test(_ast)) {
         asts[i + 1] = _ast.replace(TRIM_REG, '');


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index 74f9823..ce9b652 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -685,6 +685,13 @@ describe('Compile', function() {
         val: 'foo'
       }));
     });
+
+    it('newline after', function() {
+      var vm = '#[[This content is ignored. $val]]#\na';
+      assert.equal('This content is ignored. $val\na', render(vm, {
+        val: 'foo'
+      }));
+    });
   });
 
   describe('Object|Array#toString', function() {
Repository: shepherdwind/velocity.js
Pull request #104 (2018-06-08 23:50:39)

Add support for .put closing issue #103


Patch:
diff --git a/src/compile/references.js b/src/compile/references.js
index 0f75cfb..4425058 100644
--- a/src/compile/references.js
+++ b/src/compile/references.js
@@ -265,7 +265,8 @@ module.exports = function(Velocity, utils) {
       } else if (id === 'size') {
 
         return getSize(baseRef);
-
+      } else if (id === 'put') {
+        return baseRef[this.getLiteral(property.args[0])] = this.getLiteral(property.args[1]);
       } else {
 
         ret = baseRef[id];


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index ce9b652..61ebecb 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -694,6 +694,18 @@ describe('Compile', function() {
     });
   });
 
+  describe('assignment via .put', function () {
+    it('should set a key to an object', function() {
+      var vm = `
+        #set($foo = {})
+        #set($test = $foo.put('foo', 'bar'))
+        $foo["foo"]
+      `;
+      var expected = 'bar';
+      assert.equal(render(vm).trim(), expected)
+    });
+  });
+
   describe('Object|Array#toString', function() {
     it('simple object', function() {
       var vm = '$data';
Repository: shepherdwind/velocity.js
Pull request #115 (2018-09-27 13:07:43)

Added support for subList in arrays
Another one that would be nice to have.


Patch:
diff --git a/src/compile/references.js b/src/compile/references.js
index de01249..0735551 100644
--- a/src/compile/references.js
+++ b/src/compile/references.js
@@ -269,6 +269,8 @@ module.exports = function(Velocity, utils) {
         return baseRef[this.getLiteral(property.args[0])] = this.getLiteral(property.args[1]);
       } else if (id === 'add' && !baseRef[id] && typeof baseRef.push === 'function') {
         return baseRef.push(this.getLiteral(property.args[0]));
+      } else if (id === 'subList' && !baseRef[id]) {
+        return baseRef.slice(this.getLiteral(property.args[0]), this.getLiteral(property.args[1]));
       } else {
 
         ret = baseRef[id];


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index c45deeb..610e6c7 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -770,6 +770,38 @@ describe('Compile', function() {
     });
   });
 
+  describe('extracting items via .subList', function() {
+    it('should return empty array if original array is empty', function() {
+      var vm = `
+        #set($foo = [])
+        #set($bar = $foo.subList(0, 1))
+        $bar
+      `;
+      var expected = '[]';
+      assert.equal(render(vm).trim(), expected)
+    });
+
+    it('should return a single item', function() {
+      var vm = `
+        #set($foo = [1, 2, 3])
+        #set($bar = $foo.subList(0, 1))
+        $bar
+      `;
+      var expected = '[1]';
+      assert.equal(render(vm).trim(), expected)
+    });
+
+    it('should return multiple items', function() {
+      var vm = `
+        #set($foo = [1, 2, 3])
+        #set($bar = $foo.subList(1, 3))
+        $bar
+      `;
+      var expected = '[2, 3]';
+      assert.equal(render(vm).trim(), expected)
+    });
+  });
+
   describe('Object|Array#toString', function() {
     it('simple object', function() {
       var vm = '$data';
Repository: shepherdwind/velocity.js
Pull request #124 (2019-08-26 14:36:31)

Added support for remove in ArrayList and Map


Patch:
diff --git a/src/compile/references.js b/src/compile/references.js
index 0735551..f1e4d6c 100644
--- a/src/compile/references.js
+++ b/src/compile/references.js
@@ -269,6 +269,30 @@ module.exports = function(Velocity, utils) {
         return baseRef[this.getLiteral(property.args[0])] = this.getLiteral(property.args[1]);
       } else if (id === 'add' && !baseRef[id] && typeof baseRef.push === 'function') {
         return baseRef.push(this.getLiteral(property.args[0]));
+      } else if (id === 'remove') {
+
+        if (utils.isArray(baseRef)) {
+          
+          if (typeof index === 'number') {
+            var index = this.getLiteral(property.args[0]);
+          } else {
+            var index = baseRef.indexOf(this.getLiteral(property.args[0]));
+          }
+
+          ret = baseRef[index];
+          baseRef.splice(index, 1);
+          return ret;
+
+        } else if (utils.isObject(baseRef)) {
+
+          ret = baseRef[this.getLiteral(property.args[0])];
+          delete baseRef[this.getLiteral(property.args[0])];
+          return ret; 
+
+        }
+        
+        return undefined;
+
       } else if (id === 'subList' && !baseRef[id]) {
         return baseRef.slice(this.getLiteral(property.args[0]), this.getLiteral(property.args[1]));
       } else {


Test patch:
diff --git a/tests/compile.js b/tests/compile.js
index 610e6c7..2b608aa 100644
--- a/tests/compile.js
+++ b/tests/compile.js
@@ -738,6 +738,48 @@ describe('Compile', function() {
     });
   });
 
+  describe('deletion via .remove', function () {
+    it('should remove a key from an object', function() {
+      var vm = `
+        #set($test = {'foo': 'bar'})
+        #set($baz = $test.remove('foo'))
+        $test
+      `;
+      var expected = '{}';
+      assert.equal(render(vm).trim(), expected);
+    });
+
+    it('should return the value of the removed key', function () {
+      var vm = `
+        #set($test = {'foo': 'bar'})
+        #set($baz = $test.remove('foo'))
+        $baz
+      `;
+      var expected = 'bar';
+      assert.equal(render(vm).trim(), expected);
+    });
+
+    it('should remove a value from an array', function () {
+      var vm = `
+        #set($test = ['foo', 'bar'])
+        #set($baz = $test.remove('bar'))
+        $test
+      `;
+      var expected = '[foo]';
+      assert.equal(render(vm).trim(), expected);
+    });
+
+    it('should return the removed value', function () {
+      var vm = `
+        #set($test = ['foo', 'bar'])
+        #set($baz = $test.remove('bar'))
+        $baz
+      `;
+      var expected = 'bar';
+      assert.equal(render(vm).trim(), expected);
+    });
+  });
+
   describe('Add into empty array', function () {
     it('should add item to array', function() {
       var vm = `