Skip to content

Commit 5bbb344

Browse files
authored
Fix experimental rescript config (#7836)
* Add failing test * Add experimental feature to parser_args as well. * Fix clippy warning. * Add changelog entry
1 parent 450a709 commit 5bbb344

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Show `Stdlib.Null` and `Stdlib.Nullable` completions for `Stdlib.null<'a>` and `Stdlib.nullable<'a>` types, respectively. https://github.com/rescript-lang/rescript/pull/7826
2525
- Fix generation of interfaces for module types containing multiple type constraints. https://github.com/rescript-lang/rescript/pull/7825
2626
- JSX preserve mode: fix "make is not a valid component name". https://github.com/rescript-lang/rescript/pull/7831
27+
- Rewatch: include parser arguments of experimental features. https://github.com/rescript-lang/rescript/pull/7836
2728

2829
#### :memo: Documentation
2930

rewatch/src/build/parse.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ pub fn parser_args(
253253
let jsx_module_args = root_config.get_jsx_module_args();
254254
let jsx_mode_args = root_config.get_jsx_mode_args();
255255
let jsx_preserve_args = root_config.get_jsx_preserve_args();
256+
let experimental_features_args = root_config.get_experimental_features_args();
256257
let bsc_flags = config::flatten_flags(&package_config.compiler_flags);
257258

258259
let file = PathBuf::from("..").join("..").join(file);
@@ -265,6 +266,7 @@ pub fn parser_args(
265266
jsx_module_args,
266267
jsx_mode_args,
267268
jsx_preserve_args,
269+
experimental_features_args,
268270
bsc_flags,
269271
vec![
270272
"-absname".to_string(),

rewatch/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ impl<'de> serde::Deserialize<'de> for ExperimentalFeature {
251251
other => {
252252
let available = ["LetUnwrap"].join(", ");
253253
Err(DeError::custom(format!(
254-
"Unknown experimental feature '{}'. Available features: {}",
255-
other, available
254+
"Unknown experimental feature '{other}'. Available features: {available}",
256255
)))
257256
}
258257
}

rewatch/tests/experimental.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@ if [ $? -ne 0 ]; then
2323
exit 1
2424
fi
2525

26-
# Expect repeated string-list style: presence of -enable-experimental and LetUnwrap entries
27-
echo "$stdout" | grep -q '"-enable-experimental"' && echo "$stdout" | grep -q '"LetUnwrap"'
28-
if [ $? -ne 0 ]; then
26+
# Expect repeated string-list style: two "-enable-experimental" entries and "LetUnwrap" present
27+
enable_count=$(echo "$stdout" | grep -o '"-enable-experimental"' | wc -l | xargs)
28+
echo "$stdout" | grep -q '"LetUnwrap"'
29+
letunwrap_ok=$?
30+
if [ "$enable_count" -ne 2 ] || [ $letunwrap_ok -ne 0 ]; then
2931
mv rescript.json.bak rescript.json
30-
error "-enable-experimental / LetUnwrap not found in compiler-args output"
32+
error "Expected two occurrences of -enable-experimental and presence of LetUnwrap in compiler-args output"
3133
echo "$stdout"
3234
exit 1
3335
fi
3436

3537
# Restore original rescript.json
3638
mv rescript.json.bak rescript.json
3739

38-
success "experimentalFeatures emits -enable-experimental as string list"
40+
success "experimentalFeatures emits -enable-experimental twice as string list"

0 commit comments

Comments
 (0)