Repository navigation
Conversation
Why:
The build system passed the entries of compiler-flags to the compiler
unchecked. An unknown flag failed every module with the same error,
and a flag that the build system sets itself, such as -bs-ns, silently
conflicted with its own. A build now checks the flags of every package
against the compiler's flag table once, without applying them. Format,
clean and compiler-args don't compile, so they don't check them.
Diagnostic added (unknown compiler flag):
Example:
// rescript.json
{"name": "flags", "sources": ["src"], "compiler-flags": ["-bs-fooo"]}
Before (diagnostic):
Unknown option "-bs-fooo".
(for every module)
After (diagnostic):
rescript.json: field "compiler-flags": unknown flag "-bs-fooo"
The other new errors: a flag without its value, a value where a flag is
expected, a flag the build system sets itself (-o, -bs-ns,
-bs-package-name, -bs-package-output, -bs-project-root, -bs-read-cmi,
-bs-ast, -runtime-path), and a flag with which the compiler does not
compile (-e, -v, -version, -warn-help, -format, -reprint-source).
Review: Why not run the flag parser on the flags? Some flags act when
parsed: -e compiles a string, -v prints and exits, -format reads a
file. Values such as warning specs are checked once a typed request
replaces the flag strings (#9303).
Part of #9303
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHAzsdStoCEpBgx2tS
Signed-off-by: Christoph Knittel <ck@cca.io>
Changelog💅 Polish
Semantic Diff1 commit · Full page Check compiler-flags when a build starts84940e7 · cknitt + Claude · Nov 14, 2026, 09:37 UTC
Diagnostic added (unknown compiler flag) // rescript.json
{"name": "flags", "sources": ["src"], "compiler-flags": ["-bs-fooo"]}
-Unknown option "-bs-fooo".
-(for every module)
+rescript.json: field "compiler-flags": unknown flag "-bs-fooo"The other new errors: a flag without its value, a value where a flag is expected, a flag the build system sets itself (-o, -bs-ns, -bs-package-name, -bs-package-output, -bs-project-root, -bs-read-cmi, -bs-ast, -runtime-path), and a flag with which the compiler does not compile (-e, -v, -version, -warn-help, -format, -reprint-source). Part of #9303 Review
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9304 +/- ##
==========================================
- Coverage 82.06% 82.06% -0.01%
==========================================
Files 455 455
Lines 65399 65411 +12
==========================================
+ Hits 53672 53679 +7
- Misses 11727 11732 +5
🚀 New features to boost your workflow:
|
✅ Compiler benchmarksAllocated wordsIn total: 640,953,454 → 640,960,318 (±0.00%). Generated projects: 920,897,697 → 920,902,093 (±0.00%). None of the 265 benchmarks changed by 0.1% or more. InstructionsIn total: 9,209,713,949 → 9,209,427,884 (±0.00%). None of the 33 benchmarks changed by 0.1% or more. Output sizeIn total: 25,843,406 → 25,843,406 (±0.00%). None of the 13 benchmarks changed by 0.1% or more. Pull request 84940e7 compared with base 1efa212 in this run. |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9304 |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Step 1 of #9303.
The build system passed
compiler-flagsfromrescript.jsonto the compiler unchecked:-bs-ns, silently conflicted with its own.A build now checks each package's flags once, before compiling, and reports a problem as an error in that
rescript.json:Rescript_compiler_driver.check_flagswalks the flags against bsc's own flag table, like the parser does, but doesn't apply them. Some flags act as soon as they're parsed:-ecompiles a string,-vprints and exits,-formatreads a file.format,cleanandcompiler-argsdon't check the flags, so a bad flag doesn't stop formatting.Tests
rewatch/tests/compile/25-invalid-compiler-flags.sh: each kind of error. It also checks that formatting ignores the flags and that valid flags still build.check_flags, including values that start with a dash and a reserved flag's name used as a value.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gHAzsdStoCEpBgx2tS