`in` operator on a struct doesn't respect `expr` tags
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 65/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Go
- Estrelas
- 8k
- Forks
- 533
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de expr-lang/expr
-
Docs: Built in functions shadow user variablesTalvez já em andamento @sanmaxdev assumiu há 109 dias. Abertadocs needed
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 62/100
-
`find`, `findIndex`, `first` and `get` are type-checked as the element type where they return nilTalvez já em andamento @TastyHeadphones assumiu há 26 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
-
Release latest master branchAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
Todas as issues de expr-lang/expr
Issues semelhantes
-
Aspect/API Severity/Major Type/Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
wso2/api-platform#3899 ·
Mantenedores costumam responder em até 1 dia
-
bug needs-acceptance wg/agentic-context
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
vllm-project/semantic-router#5418 ·
Mantenedores costumam responder em até 1 dia
-
feature suggestion
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
openvibely/openvibely#1526 ·
Mantenedores costumam responder em até 1 dia
-
docs good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Usenova-Labs/usenova-backend#36 ·
Mantenedores costumam responder em até 1 dia
-
[Feature]: expose list_executors to task-mode agents (custom executor IDs are undiscoverable)Abertaenhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia