File tree Expand file tree Collapse file tree 4 files changed +23
-12
lines changed
Expand file tree Collapse file tree 4 files changed +23
-12
lines changed Original file line number Diff line number Diff line change 3131#### :nail_care : Polish
3232
3333- Rewatch: enable ` --create-sourcedirs ` by default (now deprecated when explicitly used). https://github.com/rescript-lang/rescript/pull/8092
34+ - Rewatch: check if filename case for interface and implementation matches. https://github.com/rescript-lang/rescript/pull/8144
3435
3536#### :house : Internal
3637
Original file line number Diff line number Diff line change @@ -811,6 +811,20 @@ pub fn parse_packages(build_state: &mut BuildState) -> Result<()> {
811811 } ;
812812 match source_files. get ( & implementation_filename) {
813813 None => {
814+ if let Some ( implementation_path) = source_files. keys ( ) . find ( |path| {
815+ let extension = path. extension ( ) . and_then ( |ext| ext. to_str ( ) ) ;
816+ matches ! ( extension, Some ( ext) if helpers:: is_implementation_file( ext) )
817+ && helpers:: file_path_to_module_name ( path, & namespace) == module_name
818+ } ) {
819+ let implementation_display =
820+ implementation_path. to_string_lossy ( ) . to_string ( ) ;
821+ let interface_display = file. to_string_lossy ( ) . to_string ( ) ;
822+ return Err ( anyhow ! (
823+ "Implementation and interface have different path names or different cases: `{}` vs `{}`" ,
824+ implementation_display,
825+ interface_display
826+ ) ) ;
827+ }
814828 println ! (
815829 "{} No implementation file found for interface file (skipping): {}" ,
816830 LINE_CLEAR ,
Original file line number Diff line number Diff line change @@ -2,17 +2,15 @@ import * as assert from "node:assert";
22import { setup } from "#dev/process" ;
33import { normalizeNewlines } from "#dev/utils" ;
44
5- const { execBuildLegacy } = setup ( import . meta. dirname ) ;
5+ const { execBuild } = setup ( import . meta. dirname ) ;
66
7- const { stderr } = await execBuildLegacy ( ) ;
7+ const { stderr } = await execBuild ( ) ;
88
99if (
1010 ! [
11- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src/demo vs src/Demo\n" ,
11+ "Could not initialize build: Implementation and interface have different path names or different cases: ` src/demo.res` vs ` src/Demo.resi` \n" ,
1212 // Windows: path separator
13- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src\\demo vs src\\Demo\n" ,
14- // Linux: files are parsed in different order
15- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src/Demo vs src/demo\n" ,
13+ "Could not initialize build: Implementation and interface have different path names or different cases: `src\\demo.res` vs `src\\Demo.resi`\n" ,
1614 ] . includes ( normalizeNewlines ( stderr ) )
1715) {
1816 assert . fail ( stderr ) ;
Original file line number Diff line number Diff line change @@ -4,17 +4,15 @@ import * as assert from "node:assert";
44import { setup } from "#dev/process" ;
55import { normalizeNewlines } from "#dev/utils" ;
66
7- const { execBuildLegacy } = setup ( import . meta. dirname ) ;
7+ const { execBuild } = setup ( import . meta. dirname ) ;
88
9- const { stderr } = await execBuildLegacy ( ) ;
9+ const { stderr } = await execBuild ( ) ;
1010
1111if (
1212 ! [
13- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src/X vs src/x\n" ,
13+ "Could not initialize build: Implementation and interface have different path names or different cases: ` src/X.res` vs ` src/x.resi` \n" ,
1414 // Windows: path separator
15- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src\\X vs src\\x\n" ,
16- // Linux: files are parsed in different order
17- "Error: Invalid rescript.json: implementation and interface have different path names or different cases src/x vs src/X\n" ,
15+ "Could not initialize build: Implementation and interface have different path names or different cases: `src\\X.res` vs `src\\x.resi`\n" ,
1816 ] . includes ( normalizeNewlines ( stderr ) )
1917) {
2018 assert . fail ( stderr ) ;
You can’t perform that action at this time.
0 commit comments