PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: mgechev/revive (go)
Issue: range-val-in-closure: incorrectly flags struct key if the key has the same name as a range variable
```go
package main

type t struct {
	key string
}

func main() {
	m := map[string]string{
		"a": "b",
	}

	for key := range m {
		myKey := key
		go func() {
			println(t{key: myKey})
		}()
	}
}
```

```
junk.go:15:14: range-val-in-closure: loop variable key captured by func literal (revive)
			println(t{key: myKey})
```
Pull request description: fix issue #637
Closes #637


Patch:
diff --git a/rule/range-val-in-closure.go b/rule/range-val-in-closure.go
index 857787b..0547b8d 100644
--- a/rule/range-val-in-closure.go
+++ b/rule/range-val-in-closure.go
@@ -87,15 +87,25 @@ func (w rangeValInClosure) Visit(node ast.Node) ast.Visitor {
 	if !ok {
 		return w
 	}
+
 	if lit.Type == nil {
 		// Not referring to a variable (e.g. struct field name)
 		return w
 	}
-	ast.Inspect(lit.Body, func(n ast.Node) bool {
+
+	var inspector func(n ast.Node) bool
+	inspector = func(n ast.Node) bool {
+		kv, ok := n.(*ast.KeyValueExpr)
+		if ok {
+			// do not check identifiers acting as key in key-value expressions (see issue #637)
+			ast.Inspect(kv.Value, inspector)
+			return false
+		}
 		id, ok := n.(*ast.Ident)
 		if !ok || id.Obj == nil {
 			return true
 		}
+
 		for _, v := range vars {
 			if v.Obj == id.Obj {
 				w.onFailure(lint.Failure{
@@ -106,6 +116,7 @@ func (w rangeValInClosure) Visit(node ast.Node) ast.Visitor {
 			}
 		}
 		return true
-	})
+	}
+	ast.Inspect(lit.Body, inspector)
 	return w
 }


Test patch:
diff --git a/testdata/range-val-in-closure.go b/testdata/range-val-in-closure.go
index cdda5d0..3d02972 100644
--- a/testdata/range-val-in-closure.go
+++ b/testdata/range-val-in-closure.go
@@ -24,14 +24,26 @@ func foo() {
 
 	for i, newg := range groups {
 		go func(newg int) {
-			newg.run(m.opts.Context,i) // MATCH /loop variable i captured by func literal/
+			newg.run(m.opts.Context, i) // MATCH /loop variable i captured by func literal/
 		}(newg)
 	}
 
 	for i, newg := range groups {
 		newg := newg
 		go func() {
-			newg.run(m.opts.Context,i) // MATCH /loop variable i captured by func literal/
+			newg.run(m.opts.Context, i) // MATCH /loop variable i captured by func literal/
+		}()
+	}
+}
+
+func issue637() {
+	for key := range m {
+		myKey := key
+		go func() {
+			println(t{
+				key:        myKey,
+				otherField: (10 + key), // MATCH /loop variable key captured by func literal/
+			})
 		}()
 	}
 }
Repository: MiSawa/xq (rust)
Issue: length filter on numbers should be absolute values
Currently xq returns the number value as it is but should take the absolute values.
```sh
❯ echo -128 | jq length
128

❯ echo -128 | xq length
-128

❯ xq --version
xq 0.1.4-01d8350a1d5a9f885b2b8b5c1222eb04b742ccb3
```

Pull request description: Fix length on negative number
Fixes #24 

Patch:
diff --git a/src/intrinsic/mod.rs b/src/intrinsic/mod.rs
index bb473d0..5f331bf 100644
--- a/src/intrinsic/mod.rs
+++ b/src/intrinsic/mod.rs
@@ -9,7 +9,7 @@ use crate::{
     Array, Value,
 };
 use itertools::Itertools;
-use num::ToPrimitive;
+use num::{Float, ToPrimitive};
 use phf::phf_map;
 use std::rc::Rc;
 
@@ -121,7 +121,7 @@ fn length(context: Value) -> Result<Value> {
     Ok(Value::number(match context {
         Value::Null => 0,
         Value::Boolean(_) => return Err(QueryExecutionError::InvalidArgType("length", context)),
-        Value::Number(_) => return Ok(context),
+        Value::Number(n) => return Ok(n.abs().into()),
         Value::String(s) => s.chars().count(),
         Value::Array(a) => a.len(),
         Value::Object(o) => o.len(),
@@ -279,4 +279,4 @@ fn ends_with(context: Value, s: Value) -> Result<Value> {
         (Value::String(lhs), Value::String(rhs)) => Ok(lhs.ends_with(rhs.as_ref()).into()),
         (context, _) => Err(QueryExecutionError::InvalidArgType("endswith", context)),
     }
-}
\ No newline at end of file
+}


Test patch:
diff --git a/tests/hand_written/mod.rs b/tests/hand_written/mod.rs
index 46f52a3..57979f2 100644
--- a/tests/hand_written/mod.rs
+++ b/tests/hand_written/mod.rs
@@ -84,3 +84,16 @@ test!(
     {"a": "a", "b": "b", "c": "c", "d": "d", "e": "e"}
     "#
 );
+
+test!(
+    length_on_number_yields_abs_value,
+    r#"
+    map(length)
+    "#,
+    r#"
+    [0, 128, -128, -1.5]
+    "#,
+    r#"
+    [0, 128, 128, 1.5]
+    "#
+);
\ No newline at end of file