PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: jsonata-js/jsonata (js)
Issue: Singleton operator has no effect on an array of objects
Consider the following input:
```
[
{"type":"command"},
{"type":"commands"}
]
```
and expression `$[type='command']`. It returns the first object properly. However, I want to use the singleton operator to have easier handling: `$[][type='command']` does not return an array of matches and `$[type='command'][]` does neither.
How can I always return an array of results in my case?
Pull request description: keepArray syntax should apply to all expression types
'keep array' syntax `[]` should apply to any expression type, not just location paths.

resolves #236 

Patch:
diff --git a/src/jsonata.js b/src/jsonata.js
index 1af405c..e4ec528 100644
--- a/src/jsonata.js
+++ b/src/jsonata.js
@@ -1410,6 +1410,9 @@ var jsonata = (function() {
                         throw err;
                     }
             }
+            if(expr.keepArray) {
+                result.keepArray = true;
+            }
             return result;
         };
 
@@ -1594,6 +1597,9 @@ var jsonata = (function() {
         }
 
         if(result && result.sequence) {
+            if(expr.keepArray) {
+                result.keepSingleton = true;
+            }
             result = result.value();
         }
 


Test patch:
diff --git a/test/test-suite/groups/flattening/case042.json b/test/test-suite/groups/flattening/case042.json
new file mode 100644
index 0000000..7132217
--- /dev/null
+++ b/test/test-suite/groups/flattening/case042.json
@@ -0,0 +1,5 @@
+{
+    "expr": "$[type='command'][]",
+    "data": [{"type":"command"},{"type":"commands"}],
+    "result": [{"type":"command"}]
+}
diff --git a/test/test-suite/groups/flattening/case043.json b/test/test-suite/groups/flattening/case043.json
new file mode 100644
index 0000000..0367515
--- /dev/null
+++ b/test/test-suite/groups/flattening/case043.json
@@ -0,0 +1,5 @@
+{
+    "expr": "$[][type='command']",
+    "data": [{"type":"command"},{"type":"commands"}],
+    "result": [{"type":"command"}]
+}
diff --git a/test/test-suite/groups/flattening/case044.json b/test/test-suite/groups/flattening/case044.json
new file mode 100644
index 0000000..b48a2f6
--- /dev/null
+++ b/test/test-suite/groups/flattening/case044.json
@@ -0,0 +1,5 @@
+{
+    "expr": "$filter($, function($e) { $e != 0 })[]",
+    "data": [0,0,5,0],
+    "result": [5]
+}
Repository: mgechev/revive (go)
Issue: import-shadowing shouldn't check current package name
**Describe the bug**
```go
// File: github.com/powerman/go-monolith-example/ms/auth/internal/config/config.go
package config
import "github.com/powerman/go-monolith-example/internal/config"
```
```
ms/auth/internal/config/config.go:11:9: import-shadowing: The name 'config' shadows an import name (revive)
package config
        ^
```

**To Reproduce**
I use revive bundled with golangci-lint 1.41.1.

**Expected behavior**
Within package named "x" we should be able to import/create identifiers with same name "x" - there is no shadowing in this case.

**Desktop (please complete the following information):**
 - OS: Gentoo Linux
 - go version go1.16.5 linux/amd64
Pull request description: fix 534
Closes #534 


Patch:
diff --git a/rule/import-shadowing.go b/rule/import-shadowing.go
index b78234c..7b34c90 100644
--- a/rule/import-shadowing.go
+++ b/rule/import-shadowing.go
@@ -23,7 +23,8 @@ func (r *ImportShadowingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Fa
 
 	fileAst := file.AST
 	walker := importShadowing{
-		importNames: importNames,
+		packageNameIdent: fileAst.Name,
+		importNames:      importNames,
 		onFailure: func(failure lint.Failure) {
 			failures = append(failures, failure)
 		},
@@ -57,9 +58,10 @@ func getName(imp *ast.ImportSpec) string {
 }
 
 type importShadowing struct {
-	importNames map[string]struct{}
-	onFailure   func(lint.Failure)
-	alreadySeen map[*ast.Object]struct{}
+	packageNameIdent *ast.Ident
+	importNames      map[string]struct{}
+	onFailure        func(lint.Failure)
+	alreadySeen      map[*ast.Object]struct{}
 }
 
 // Visit visits AST nodes and checks if id nodes (ast.Ident) shadow an import name
@@ -79,6 +81,10 @@ func (w importShadowing) Visit(n ast.Node) ast.Visitor {
 		*ast.StructType:   // skip analysis of struct type because struct fields can not shadow an import name
 		return nil
 	case *ast.Ident:
+		if n == w.packageNameIdent {
+			return nil // skip the ident corresponding to the package name of this file
+		}
+
 		id := n.Name
 		if id == "_" {
 			return w // skip _ id


Test patch:
diff --git a/testdata/import-shadowing.go b/testdata/import-shadowing.go
index 06f91f6..124f108 100644
--- a/testdata/import-shadowing.go
+++ b/testdata/import-shadowing.go
@@ -8,6 +8,7 @@ import (
 	_ "net/http"
 	"strings"
 	str "strings"
+	"fixtures" // Test case for issue #534
 )
 
 const str = "" // MATCH /The name 'str' shadows an import name/