A JS import named like a prelude function (`fetch`, `map`, `filter`, `len`, `str`, `sum`, `every`, `indexOf`, `fail`, `log`) is bound to `__B.<name>`, not to the import
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- javascript, typescript
Rechercherichtung
Lies compiler/src/emit.rs an den beiden im Issue genannten Stellen: In Zeile 361 werden Namen aus dem ausgegebenen JavaScript-Import gefiltert, und in Zeile 679 wird die Bindung ausgewählt. Prüfe, wie importierte Namen, die mit Prelude-Funktionen übereinstimmen, an beiden Stellen behandelt werden, und verifiziere anschließend, dass das generierte Modul fetch wie erwartet aus lib.js importiert und bindet. Das Issue ist gelöst, wenn die aufgeführten Namen an ihre JavaScript-Imports gebunden werden; .rx-Imports wurden ausdrücklich nicht getestet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Found while building a component library on ReactiveScript. Written with Claude Fable 5.2 (in Claude Code), which also ran the reproductions; all of them were rerun before posting.
@reactivescript/compiler 0.3.1, through @solidjs/vite-plugin 3.0.0-next.57 (vite dev server, plugins: [solid()]),
mounted with createApp from @reactivescript/runtime 0.3.1, in Chromium.
lib.js:
export const fetch = (key) => "lib.js got " + key;
a.rx:
import { fetch } from "./lib.js"
export default component App() {
source out := "-"
<div>
<button onClick={() => { out := fetch("x") }}>go</button>
<p>{out}</p>
</div>
}
It compiles with no diagnostic. After a click the paragraph shows
{"key":"x","first":{},"queue":[],"waiters":[],"started":false}
Expected: lib.js got x. guide/language.md, "Imperative code": "anything else from JS comes in through an
import from a .js module." CP-4c (spec/11-compiler.md) lists B.fetch and B.fail as the scenario prelude:
"Compiled code calls them only in a conformance build".
The generated module has no import from lib.js. It binds the name to the prelude:
const v$fetch = __B.fetch;
The same happens with:
- an alias:
import { fetch as get } from "./lib.js"emitsconst v$get = __B.fetch; - a declaration beside the module:
lib.d.rxcontainingexport fn fetch(key: string): stringis accepted and
changes nothing; - each of the other nine names: the generated code binds every one to
__B.<name>. Of those I ran onlyfail,
where the call throws the prelude's panic.
In compiler/src/emit.rs on main (eab7356, read, not built) two places exclude these names for a JS import: line
361 filters them out of the emitted import list (!builtin(&n.name) && n.name != "log"), and line 679 chooses
the binding (self.js_import(from) && !builtin(name) && name != "log"), which falls through to the __B branch.
Not tested: an import of one of these names from another .rx module.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 127
- Forks
- 7
- Ø Merge
- 15 Std. 42 Min.
- Gemergte PRs (30 T.)
- 63
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
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 solidjs/reactivescript
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
solidjs/reactivescript#96 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedEvtl. vergeben @cgaaf hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
solidjs/reactivescript#84 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
solidjs/reactivescript#77 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
solidjs/reactivescript#97 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
solidjs/reactivescript#83 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in solidjs/reactivescript
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
TriliumNext/Trilium#12837 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
LibreChat-AI/LibreChat#18944 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug root-cause:found
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
openchamber/openchamber#7620 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Anatomik5/codetovideo#8 ·
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag