`in` operator on a struct doesn't respect `expr` tags
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 65/100
Rechercherichtung
The issue is about the 'in' operator not respecting struct field tags. Start by examining the parser and evaluator for the 'in' operator, likely in the 'parser' and 'eval' packages. Look at how struct field access is resolved, comparing the handling of field names vs. 'expr' tags. The provided playground link shows the exact test case; run the tests in the repository to see existing behavior and add a test for this bug. Check for similar issues around struct field tag handling to understand the codebase patterns.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
While the documentation doesn't say that the in operator can be used on structs, it does actually work.
However it doesn't respect the expr tag and instead checks membership using the struct's go field names.
Example
With an environment built from:
type Outer struct {
Inner map[string]struct{} `expr:"bar"`
}
type Env struct {
Outer Outer `expr:"foo"`
}
in operator:
"bar" in foo => false
"Inner" in foo => true
Field access behaves the opposite:
foo.bar => map[]
foo.Inner => compilation error
Playground: https://go.dev/play/p/GqjjiidBOx0
- Vorherrschende Sprache
- Go
- Sterne
- 8k
- Forks
- 529
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus expr-lang/expr
-
docs needed
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 62/100
-
`find`, `findIndex`, `first` and `get` are type-checked as the element type where they return nil Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
Ähnliche Issues
-
agentic-workflows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
agentic-workflows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
microsoft/agent-framework-go#1179 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
[Bug]: OLLAMA_KEEP_ALIVE="5m" / "24h" crashes Ollama embedding and vision models with ValueError Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
infiniflow/ragflow#20223 · 1 Reaktion ·
-
bug needs triage pkg/translator/faro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
open-telemetry/opentelemetry-collector-contrib#51484 · 1 Kommentar ·