Skip to content

Commit a1b89c9

Browse files
cknittcristianoc
authored andcommitted
Remove more .re syntax leftovers (rescript-lang#5712)
1 parent 7d84a5b commit a1b89c9

23 files changed

+64
-99
lines changed

jscomp/bsb/bsb_file_groups.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type file_group = {
3838
is_dev : bool;
3939
generators : build_generator list;
4040
(* output of [generators] should be added to [sources],
41-
if it is [.ml,.mli,.re,.rei]
41+
if it is [.ml,.mli,.res,.resi]
4242
*)
4343
}
4444

jscomp/bsb/bsb_file_groups.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type file_group = {
3939
(* false means not in dev mode *)
4040
generators : build_generator list;
4141
(* output of [generators] should be added to [sources],
42-
if it is [.ml,.mli,.re,.rei]
42+
if it is [.ml,.mli,.res,.resi]
4343
*)
4444
}
4545

jscomp/gentype/EmitJs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
229229
("In case of type error, check the type of '" ^ valueName
230230
^ "' in '"
231231
^ (fileName |> ModuleName.toString)
232-
^ ".re'" ^ " and '"
232+
^ ".res'" ^ " and '"
233233
^ (importPath |> ImportPath.emit)
234234
^ "'.")
235235
~early:true ~emitters ~name:valueNameTypeChecked ~type_

jscomp/gentype/GenTypeMain.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ let processCmtFile cmt =
104104
let isInterface = Filename.check_suffix cmtFile ".cmti" in
105105
let resolver =
106106
ModuleResolver.createLazyResolver ~config
107-
~extensions:[ ".re"; ".res"; EmitType.shimExtension ]
107+
~extensions:[ ".res"; EmitType.shimExtension ]
108108
~excludeFile:(fun fname ->
109-
fname = "React.re" || fname = "ReasonReact.re")
109+
fname = "React.res" || fname = "ReasonReact.res")
110110
in
111111
let inputCMT, hasGenTypeAnnotations =
112112
let inputCMT = readCmt cmtFile in

jscomp/gentype/ModuleResolver.ml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,28 +195,25 @@ let apply ~resolver ~useBsDependencies moduleName =
195195
moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies
196196

197197
(** Resolve a reference to ModuleName, and produce a path suitable for require.
198-
E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *)
198+
E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *)
199199
let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
200200
~resolver ~useBsDependencies moduleName =
201201
let outputFileRelativeDir =
202-
(* e.g. src if we're generating src/File.re.js *)
202+
(* e.g. src if we're generating src/File.bs.js *)
203203
Filename.dirname outputFileRelative
204204
in
205205
let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in
206-
let moduleNameReFile =
207-
(* Check if the module is in the same directory as the file being generated.
208-
So if e.g. project_root/src/ModuleName.re exists. *)
209-
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re")
210-
in
211206
let moduleNameResFile =
207+
(* Check if the module is in the same directory as the file being generated.
208+
So if e.g. project_root/src/ModuleName.res exists. *)
212209
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res")
213210
in
214211
let candidate =
215212
(* e.g. import "./Modulename.ext" *)
216213
moduleName
217214
|> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension
218215
in
219-
if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then
216+
if Sys.file_exists moduleNameResFile then
220217
candidate
221218
else
222219
let rec pathToList path =
@@ -229,7 +226,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
229226
match moduleName |> apply ~resolver ~useBsDependencies with
230227
| None -> candidate
231228
| Some (resolvedModuleDir, case, bsDependencies) ->
232-
(* e.g. "dst" in case of dst/ModuleName.re *)
229+
(* e.g. "dst" in case of dst/ModuleName.res *)
233230
let walkUpOutputDir =
234231
outputFileRelativeDir |> pathToList
235232
|> List.map (fun _ -> Filename.parent_dir_name)

jscomp/gentype/Paths.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let getBsConfigFile ~projectRoot =
6161
match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None
6262

6363
(** Find the relative path from /.../bs/lib
64-
e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *)
64+
e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *)
6565
let relativePathFromBsLib fileName =
6666
if Filename.is_relative fileName then fileName
6767
else
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Use the annotations, and definitions, from the .re file
1+
// Use the annotations, and definitions, from the .res file
22
@@genType.ignoreInterface
33

44
@genType type t

jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {default as makeNotChecked} from './hookExample';
66

77
import {default as defaultNotChecked} from './hookExample';
88

9-
// In case of type error, check the type of 'make' in 'ImportHookDefault.re' and './hookExample'.
9+
// In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'.
1010
export const makeTypeChecked: React.ComponentType<{
1111
readonly person: person;
1212
readonly children: React.ReactNode;
@@ -20,7 +20,7 @@ export const make: unknown = makeTypeChecked as React.ComponentType<{
2020
readonly renderMe: ImportHooks_renderMe<string>
2121
}>;
2222

23-
// In case of type error, check the type of 'default' in 'ImportHookDefault.re' and './hookExample'.
23+
// In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'.
2424
export const defaultTypeChecked: React.ComponentType<{
2525
readonly person: person;
2626
readonly children: React.ReactNode;

jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample';
66

77
import {foo as fooNotChecked} from './hookExample';
88

9-
// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.re' and './hookExample'.
9+
// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'.
1010
export const makeRenamedTypeChecked: React.ComponentType<{
1111
readonly actions?: JSX.Element;
1212
readonly person: person;
@@ -22,7 +22,7 @@ export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentTyp
2222
readonly renderMe: renderMe<any>
2323
}>;
2424

25-
// In case of type error, check the type of 'foo' in 'ImportHooks.re' and './hookExample'.
25+
// In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'.
2626
export const fooTypeChecked: (_1:{ readonly person: person }) => string = fooNotChecked;
2727

2828
// Export 'foo' early to allow circular import from the '.bs.js' file.

jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {default as defaultNotChecked} from './';
66

7-
// In case of type error, check the type of 'default' in 'ImportIndex.re' and './'.
7+
// In case of type error, check the type of 'default' in 'ImportIndex.res' and './'.
88
export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked;
99

1010
// Export '$$default' early to allow circular import from the '.bs.js' file.

jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ import {default as defaultNotChecked} from './MyMath';
2222
import * as Curry__Es6Import from 'rescript/lib/es6/curry.js';
2323
const Curry: any = Curry__Es6Import;
2424

25-
// In case of type error, check the type of 'round' in 'ImportJsValue.re' and './MyMath'.
25+
// In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'.
2626
export const roundTypeChecked: (_1:number) => number = roundNotChecked;
2727

2828
// Export 'round' early to allow circular import from the '.bs.js' file.
2929
export const round: unknown = roundTypeChecked as (_1:number) => number;
3030

31-
// In case of type error, check the type of 'area' in 'ImportJsValue.re' and './MyMath'.
31+
// In case of type error, check the type of 'area' in 'ImportJsValue.res' and './MyMath'.
3232
export const areaTypeChecked: (_1:point) => number = areaNotChecked;
3333

3434
// Export 'area' early to allow circular import from the '.bs.js' file.
3535
export const area: unknown = areaTypeChecked as (_1:point) => number;
3636

37-
// In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.re' and './MyMath'.
37+
// In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.res' and './MyMath'.
3838
export const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked;
3939

4040
// Export 'returnMixedArray' early to allow circular import from the '.bs.js' file.
4141
export const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[];
4242

43-
// In case of type error, check the type of 'useColor' in 'ImportJsValue.re' and './MyMath'.
43+
// In case of type error, check the type of 'useColor' in 'ImportJsValue.res' and './MyMath'.
4444
export const useColorTypeChecked: (_1:color) => number = useColorNotChecked;
4545

4646
// Export 'useColor' early to allow circular import from the '.bs.js' file.
4747
export const useColor: unknown = useColorTypeChecked as (_1:color) => number;
4848

49-
// In case of type error, check the type of 'higherOrder' in 'ImportJsValue.re' and './MyMath'.
49+
// In case of type error, check the type of 'higherOrder' in 'ImportJsValue.res' and './MyMath'.
5050
export const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked;
5151

5252
// Export 'higherOrder' early to allow circular import from the '.bs.js' file.
@@ -58,7 +58,7 @@ export const higherOrder: unknown = function (Arg1: any) {
5858
return result
5959
} as (_1:((_1:number, _2:number) => number)) => number;
6060

61-
// In case of type error, check the type of 'convertVariant' in 'ImportJsValue.re' and './MyMath'.
61+
// In case of type error, check the type of 'convertVariant' in 'ImportJsValue.res' and './MyMath'.
6262
export const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked;
6363

6464
// Export 'convertVariant' early to allow circular import from the '.bs.js' file.
@@ -71,13 +71,13 @@ export const convertVariant: unknown = function (Arg1: any) {
7171
: {TAG: 1, _0:result.value} as any
7272
} as (_1:variant) => variant;
7373

74-
// In case of type error, check the type of 'polymorphic' in 'ImportJsValue.re' and './MyMath'.
74+
// In case of type error, check the type of 'polymorphic' in 'ImportJsValue.res' and './MyMath'.
7575
export const polymorphicTypeChecked: <a>(_1:a) => a = polymorphicNotChecked;
7676

7777
// Export 'polymorphic' early to allow circular import from the '.bs.js' file.
7878
export const polymorphic: unknown = polymorphicTypeChecked as <a>(_1:a) => a;
7979

80-
// In case of type error, check the type of 'default' in 'ImportJsValue.re' and './MyMath'.
80+
// In case of type error, check the type of 'default' in 'ImportJsValue.res' and './MyMath'.
8181
export const defaultTypeChecked: number = defaultNotChecked;
8282

8383
// Export '$$default' early to allow circular import from the '.bs.js' file.

jscomp/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {make as makeNotChecked} from './hookExample';
66

77
import * as React from 'react';
88

9-
// In case of type error, check the type of 'make' in 'JSXV4.re' and './hookExample'.
9+
// In case of type error, check the type of 'make' in 'JSXV4.res' and './hookExample'.
1010
export const makeTypeChecked: React.ComponentType<{
1111
readonly actions?: JSX.Element;
1212
readonly person: person;

jscomp/gentype_tests/typescript-react-example/src/MyInput.gen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {default as defaultNotChecked} from './MyInput';
66

7-
// In case of type error, check the type of 'default' in 'MyInput.re' and './MyInput'.
7+
// In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'.
88
export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked;
99

1010
// Export '$$default' early to allow circular import from the '.bs.js' file.

jscomp/ounit_tests/ounit_string_tests.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ let suites =
7272
(* __LOC__ >:: begin fun _ ->
7373
OUnit.assert_bool __LOC__ @@
7474
List.for_all (fun x -> Ext_string.is_valid_source_name x = Good)
75-
["x.ml"; "x.mli"; "x.re"; "x.rei";
75+
["x.ml"; "x.mli"; "x.res"; "x.resi";
7676
"A_x.ml"; "ab.ml"; "a_.ml"; "a__.ml";
7777
"ax.ml"];
7878
OUnit.assert_bool __LOC__ @@ not @@
7979
List.exists (fun x -> Ext_string.is_valid_source_name x = Good)
80-
[".re"; ".rei";"..re"; "..rei"; "..ml"; ".mll~";
80+
[".res"; ".resi";"..res"; "..resi"; "..ml"; ".mll~";
8181
"...ml"; "_.mli"; "_x.ml"; "__.ml"; "__.rei";
8282
".#hello.ml"; ".#hello.rei"; "a-.ml"; "a-b.ml"; "-a-.ml"
8383
; "-.ml"
@@ -486,7 +486,10 @@ let suites =
486486
(Ext_filename.module_name "a/b/c.d")
487487
"C";
488488
string_eq
489-
(Ext_filename.module_name "a/b/xc.re")
489+
(Ext_filename.module_name "a/b/xc.res")
490+
"Xc";
491+
string_eq
492+
(Ext_filename.module_name "a/b/xc.resi")
490493
"Xc";
491494
string_eq
492495
(Ext_filename.module_name "a/b/xc.ml")

jscomp/test/ext_string_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ function is_valid_source_name(name) {
493493
var x = check_any_suffix_case_then_chop(name, {
494494
hd: ".ml",
495495
tl: {
496-
hd: ".re",
496+
hd: ".res",
497497
tl: {
498498
hd: ".mli",
499499
tl: {
500-
hd: ".rei",
500+
hd: ".resi",
501501
tl: /* [] */0
502502
}
503503
}

jscomp/test/ext_string_test.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ type check_result =
363363
let is_valid_source_name name : check_result =
364364
match check_any_suffix_case_then_chop name [
365365
".ml";
366-
".re";
366+
".res";
367367
".mli";
368-
".rei"
368+
".resi"
369369
] with
370370
| None -> Suffix_mismatch
371371
| Some x ->

lib/4.06.1/rescript.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4387,7 +4387,7 @@ type file_group = {
43874387
(* false means not in dev mode *)
43884388
generators : build_generator list;
43894389
(* output of [generators] should be added to [sources],
4390-
if it is [.ml,.mli,.re,.rei]
4390+
if it is [.ml,.mli,.res,.resi]
43914391
*)
43924392
}
43934393

@@ -4445,7 +4445,7 @@ type file_group = {
44454445
is_dev : bool;
44464446
generators : build_generator list;
44474447
(* output of [generators] should be added to [sources],
4448-
if it is [.ml,.mli,.re,.rei]
4448+
if it is [.ml,.mli,.res,.resi]
44494449
*)
44504450
}
44514451

lib/4.06.1/unstable/all_ounit_tests.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38643,12 +38643,12 @@ let suites =
3864338643
(* __LOC__ >:: begin fun _ ->
3864438644
OUnit.assert_bool __LOC__ @@
3864538645
List.for_all (fun x -> Ext_string.is_valid_source_name x = Good)
38646-
["x.ml"; "x.mli"; "x.re"; "x.rei";
38646+
["x.ml"; "x.mli"; "x.res"; "x.resi";
3864738647
"A_x.ml"; "ab.ml"; "a_.ml"; "a__.ml";
3864838648
"ax.ml"];
3864938649
OUnit.assert_bool __LOC__ @@ not @@
3865038650
List.exists (fun x -> Ext_string.is_valid_source_name x = Good)
38651-
[".re"; ".rei";"..re"; "..rei"; "..ml"; ".mll~";
38651+
[".res"; ".resi";"..res"; "..resi"; "..ml"; ".mll~";
3865238652
"...ml"; "_.mli"; "_x.ml"; "__.ml"; "__.rei";
3865338653
".#hello.ml"; ".#hello.rei"; "a-.ml"; "a-b.ml"; "-a-.ml"
3865438654
; "-.ml"
@@ -39057,7 +39057,10 @@ let suites =
3905739057
(Ext_filename.module_name "a/b/c.d")
3905839058
"C";
3905939059
string_eq
39060-
(Ext_filename.module_name "a/b/xc.re")
39060+
(Ext_filename.module_name "a/b/xc.res")
39061+
"Xc";
39062+
string_eq
39063+
(Ext_filename.module_name "a/b/xc.resi")
3906139064
"Xc";
3906239065
string_eq
3906339066
(Ext_filename.module_name "a/b/xc.ml")

lib/4.06.1/whole_compiler.ml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239996,28 +239996,25 @@ let apply ~resolver ~useBsDependencies moduleName =
239996239996
moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies
239997239997

239998239998
(** Resolve a reference to ModuleName, and produce a path suitable for require.
239999-
E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *)
239999+
E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *)
240000240000
let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
240001240001
~resolver ~useBsDependencies moduleName =
240002240002
let outputFileRelativeDir =
240003-
(* e.g. src if we're generating src/File.re.js *)
240003+
(* e.g. src if we're generating src/File.bs.js *)
240004240004
Filename.dirname outputFileRelative
240005240005
in
240006240006
let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in
240007-
let moduleNameReFile =
240008-
(* Check if the module is in the same directory as the file being generated.
240009-
So if e.g. project_root/src/ModuleName.re exists. *)
240010-
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re")
240011-
in
240012240007
let moduleNameResFile =
240008+
(* Check if the module is in the same directory as the file being generated.
240009+
So if e.g. project_root/src/ModuleName.res exists. *)
240013240010
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res")
240014240011
in
240015240012
let candidate =
240016240013
(* e.g. import "./Modulename.ext" *)
240017240014
moduleName
240018240015
|> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension
240019240016
in
240020-
if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then
240017+
if Sys.file_exists moduleNameResFile then
240021240018
candidate
240022240019
else
240023240020
let rec pathToList path =
@@ -240030,7 +240027,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
240030240027
match moduleName |> apply ~resolver ~useBsDependencies with
240031240028
| None -> candidate
240032240029
| Some (resolvedModuleDir, case, bsDependencies) ->
240033-
(* e.g. "dst" in case of dst/ModuleName.re *)
240030+
(* e.g. "dst" in case of dst/ModuleName.res *)
240034240031
let walkUpOutputDir =
240035240032
outputFileRelativeDir |> pathToList
240036240033
|> List.map (fun _ -> Filename.parent_dir_name)
@@ -240150,7 +240147,7 @@ let getBsConfigFile ~projectRoot =
240150240147
match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None
240151240148

240152240149
(** Find the relative path from /.../bs/lib
240153-
e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *)
240150+
e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *)
240154240151
let relativePathFromBsLib fileName =
240155240152
if Filename.is_relative fileName then fileName
240156240153
else
@@ -241969,7 +241966,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
241969241966
("In case of type error, check the type of '" ^ valueName
241970241967
^ "' in '"
241971241968
^ (fileName |> ModuleName.toString)
241972-
^ ".re'" ^ " and '"
241969+
^ ".res'" ^ " and '"
241973241970
^ (importPath |> ImportPath.emit)
241974241971
^ "'.")
241975241972
~early:true ~emitters ~name:valueNameTypeChecked ~type_
@@ -243731,9 +243728,9 @@ let processCmtFile cmt =
243731243728
let isInterface = Filename.check_suffix cmtFile ".cmti" in
243732243729
let resolver =
243733243730
ModuleResolver.createLazyResolver ~config
243734-
~extensions:[ ".re"; ".res"; EmitType.shimExtension ]
243731+
~extensions:[ ".res"; EmitType.shimExtension ]
243735243732
~excludeFile:(fun fname ->
243736-
fname = "React.re" || fname = "ReasonReact.re")
243733+
fname = "React.res" || fname = "ReasonReact.res")
243737243734
in
243738243735
let inputCMT, hasGenTypeAnnotations =
243739243736
let inputCMT = readCmt cmtFile in

0 commit comments

Comments
 (0)