Repository navigation
JSX: h is the default factory (the default library's where the program has none); no "failed statement" after an error - #1124
Merged
Conversation
…ram has none; no "failed statement" after an error - With no factory named (@jsx, --jsx-factory, "jsxFactory"), an element calls `h` and a fragment's tag is `Fragment` (user ruling; tsc's React.createElement / React.Fragment only when named). Where the program declares no `h` / `Fragment`, they are the default library's __jsx_h / __jsx_Fragment, asked again on every pass so a program's `h` declared after the element still wins. So `tslang file.tsx` runs, and `--jsx-factory=h` with no `h` declared too - -mm=own: the library's factory is one clear error at the element (an element keeps its children) - The "factory can't be found" error is shorter, and still names `h` when there is no library - MLIRGenModule: "failed statement" is reported only when the statement failed without an error of its own (it followed every error, saying nothing more) - Tests: jsx-options (the default `h`/`Fragment`, one error with no "failed statement"), 00jsx_default_factory uses the program's own `h`, crash-errors name `h`, and defaultlib/jsx_default_factory.tsx runs against the real default library (gc, rc; jit and exe) - docs/jsx.md: the library's `h`, components, what an element prints Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs DefaultLib ASDAlexander77/TypeScriptCompilerDefaultLib#133 (
__jsx_h,JsxElement,__jsx_Fragment).User ruling:
hcomes with the default library and is the default factory, sotslang file.tsxruns with no flags. It makes aJsxElementthat prints as HTML.hand a fragment's tag isFragment. tsc'sReact.createElement/React.Fragmentare used only when named. Where the program declares noh/Fragment, the call goes to the library's__jsx_h/__jsx_Fragment. This is decided again on every pass, so a program'shdeclared after the element still wins.--jsx-factory=hwith nohdeclared also uses the library's-mm=own: the library's factory gives one clear error at the element. A typed factory of the program's own still works thereh/Fragment, and exactly one error with no "failed statement"),00jsx_default_factorynow uses the program's ownh, crash-errors nameh, and the newdefaultlib/jsx_default_factory.tsxruns against the real default library (gc and rc, JIT and exe; skipped when no library is built)Local: Release ctest, 10424/10424 passed (with the DefaultLib branch built).
🤖 Generated with Claude Code