Diagnostic: assigning to a property of an AA read from a node field is a no-op

Aperta
#1,927 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devtools

Direzione di ricerca

Start by tracing how BrighterScript detects type information and emits warnings for assignments, then find the handling of member-access chains. The issue gives no file or test names, so first locate related diagnostics and tests. Done means assignments matching the described node-field-AA pattern at any depth produce a warning with a useful fix suggestion, while unrelated assignments do not.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Reading an associative array field from a node (e.g. m.top.metadata) returns a copy, so assigning to its properties silently does nothing:

with m.top.metadata
    .a = 1
    .b = 2
    .c = 3
end with

m.top.metadata.a = 1
m.top.metadata.b = 1
m.top.metadata.c = 1

None of these assignments update the node's field.

This isn't specific to m.top. It applies anywhere in a member-access chain: whenever a segment is a node, the next segment is an AA field on that node, and a property of that AA is then assigned, the assignment is a no-op. For example:

m.top.findNode("child").metadata.a = 1
someNode.child.grandchild.settings.enabled = true
m.config.playerNode.metadata.title.text = "x" ' deeper props off the copied AA are also lost

When the type system can see <AnyNode>.<AA field>.<prop> = ... at any depth, BrighterScript should emit a warning that the assignment is a no-op (and suggest reading into a local, mutating it, then assigning it back, or using .update()/setField).

🤖 Generated with Claude Code

Lingua principale
TypeScript
Stelle
212
Fork
72
Merge medio
3g 3h
PR unite (30g)
63

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rokucommunity/brighterscript

Tutte le issue di rokucommunity/brighterscript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.