Repository navigation
Conversation
Changelog💅 Polish
Semantic Diff1 commit · Full page Check compiler-flags when a build startsb71a28a · 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.21% 82.20% -0.01%
==========================================
Files 460 460
Lines 65551 65563 +12
==========================================
+ Hits 53891 53898 +7
- Misses 11660 11665 +5
🚀 New features to boost your workflow:
|
✅ Compiler benchmarksAllocated wordsIn total: 636,509,233 → 636,516,050 (±0.00%). Generated projects: 629,028,638 → 629,034,939 (±0.00%). None of the 265 benchmarks changed by 0.1% or more. InstructionsIn total: 9,221,447,599 → 9,221,526,116 (±0.00%). None of the 33 benchmarks changed by 0.1% or more. Output sizeIn total: 25,962,507 → 25,962,507 (±0.00%). None of the 13 benchmarks changed by 0.1% or more. Pull request b71a28a compared with base 643e9c0 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". |
84940e7 to
4e7b646
Compare
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>
4e7b646 to
b71a28a
Compare
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