--ffi manifest fails with SC5002 when the program does not use a binding

Aperta
#3,531 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Read the check near line 330 in packages/compiler/src/frontend/lowering/native-ffi.ts and the "unused-missing" case in tests/harness/ffi.test.ts. Run that test to confirm the current behavior, then determine whether unused manifest bindings should be accepted or warned about. Done means the shared manifest case behaves as specified and the harness covers it, or a documentation note explains the intentional behavior.

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

Descrizione

scriptc 0.4.11, main at 918d80b26a, macOS arm64.

--ffi manifest with a binding the program never declares.

// unused.ts
console.log("unrelated");

ffi.json: {"ffi_format":1,"functions":[{"name":"nativeScale","symbol":"native_scale","params":["f64"],"returns":"f64"}],"libraries":[],"system_libraries":[]}

scriptc build unused.ts --ffi ffi.json fails with SC5002: FFI binding 'nativeScale' cannot be resolved: the program has no signature-only function declaration with this name.

Expected: a shared manifest listing bindings for several programs should not fail a program that does not use all of them (or the unused case should be a warning). Today one manifest per entry point is needed. The behavior is pinned by the "unused-missing" case in tests/harness/ffi.test.ts, so if it is intentional, a docs note would help. Check is in packages/compiler/src/frontend/lowering/native-ffi.ts (~line 330).

Lingua principale
TypeScript
Stelle
6.5k
Fork
212
Merge medio
13h 46m
PR unite (30g)
787

Preparare l'ambiente

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 vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.