`in` operator on a struct doesn't respect `expr` tags
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 8k
- Fork
- 529
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di expr-lang/expr
-
docs needed
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
-
`find`, `findIndex`, `first` and `get` are type-checked as the element type where they return nil Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
Release latest master branch Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
Tutte le issue di expr-lang/expr
Issue simili
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
microsoft/agent-framework-go#1179 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
[Bug]: OLLAMA_KEEP_ALIVE="5m" / "24h" crashes Ollama embedding and vision models with ValueError Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
infiniflow/ragflow#20223 · 1 reazione ·
-
bug needs triage pkg/translator/faro
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
open-telemetry/opentelemetry-collector-contrib#51484 · 1 commento ·