Skip to content

Commit 3aedb24

Browse files
authored
Remove more .re syntax leftovers (rescript-lang#5712)
1 parent e8ccf3c commit 3aedb24

23 files changed

+64
-99
lines changed

jscomp/bsb/bsb_file_groups.ml

+1-1
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

+1-1
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

+1-1
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

+2-2
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

+6-9
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

+1-1
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
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

+2-2
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

+2-2
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

+1-1
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

+8-8
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

+1-1
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

+1-1
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

+6-3
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

+2-2
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

+2-2
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

+2-2
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

+6-3
Original file line numberDiff line numberDiff line change
@@ -38647,12 +38647,12 @@ let suites =
3864738647
(* __LOC__ >:: begin fun _ ->
3864838648
OUnit.assert_bool __LOC__ @@
3864938649
List.for_all (fun x -> Ext_string.is_valid_source_name x = Good)
38650-
["x.ml"; "x.mli"; "x.re"; "x.rei";
38650+
["x.ml"; "x.mli"; "x.res"; "x.resi";
3865138651
"A_x.ml"; "ab.ml"; "a_.ml"; "a__.ml";
3865238652
"ax.ml"];
3865338653
OUnit.assert_bool __LOC__ @@ not @@
3865438654
List.exists (fun x -> Ext_string.is_valid_source_name x = Good)
38655-
[".re"; ".rei";"..re"; "..rei"; "..ml"; ".mll~";
38655+
[".res"; ".resi";"..res"; "..resi"; "..ml"; ".mll~";
3865638656
"...ml"; "_.mli"; "_x.ml"; "__.ml"; "__.rei";
3865738657
".#hello.ml"; ".#hello.rei"; "a-.ml"; "a-b.ml"; "-a-.ml"
3865838658
; "-.ml"
@@ -39061,7 +39061,10 @@ let suites =
3906139061
(Ext_filename.module_name "a/b/c.d")
3906239062
"C";
3906339063
string_eq
39064-
(Ext_filename.module_name "a/b/xc.re")
39064+
(Ext_filename.module_name "a/b/xc.res")
39065+
"Xc";
39066+
string_eq
39067+
(Ext_filename.module_name "a/b/xc.resi")
3906539068
"Xc";
3906639069
string_eq
3906739070
(Ext_filename.module_name "a/b/xc.ml")

lib/4.06.1/whole_compiler.ml

+10-13
Original file line numberDiff line numberDiff line change
@@ -239914,28 +239914,25 @@ let apply ~resolver ~useBsDependencies moduleName =
239914239914
moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies
239915239915

239916239916
(** Resolve a reference to ModuleName, and produce a path suitable for require.
239917-
E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *)
239917+
E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *)
239918239918
let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
239919239919
~resolver ~useBsDependencies moduleName =
239920239920
let outputFileRelativeDir =
239921-
(* e.g. src if we're generating src/File.re.js *)
239921+
(* e.g. src if we're generating src/File.bs.js *)
239922239922
Filename.dirname outputFileRelative
239923239923
in
239924239924
let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in
239925-
let moduleNameReFile =
239926-
(* Check if the module is in the same directory as the file being generated.
239927-
So if e.g. project_root/src/ModuleName.re exists. *)
239928-
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re")
239929-
in
239930239925
let moduleNameResFile =
239926+
(* Check if the module is in the same directory as the file being generated.
239927+
So if e.g. project_root/src/ModuleName.res exists. *)
239931239928
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res")
239932239929
in
239933239930
let candidate =
239934239931
(* e.g. import "./Modulename.ext" *)
239935239932
moduleName
239936239933
|> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension
239937239934
in
239938-
if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then
239935+
if Sys.file_exists moduleNameResFile then
239939239936
candidate
239940239937
else
239941239938
let rec pathToList path =
@@ -239948,7 +239945,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
239948239945
match moduleName |> apply ~resolver ~useBsDependencies with
239949239946
| None -> candidate
239950239947
| Some (resolvedModuleDir, case, bsDependencies) ->
239951-
(* e.g. "dst" in case of dst/ModuleName.re *)
239948+
(* e.g. "dst" in case of dst/ModuleName.res *)
239952239949
let walkUpOutputDir =
239953239950
outputFileRelativeDir |> pathToList
239954239951
|> List.map (fun _ -> Filename.parent_dir_name)
@@ -240068,7 +240065,7 @@ let getBsConfigFile ~projectRoot =
240068240065
match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None
240069240066

240070240067
(** Find the relative path from /.../bs/lib
240071-
e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *)
240068+
e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *)
240072240069
let relativePathFromBsLib fileName =
240073240070
if Filename.is_relative fileName then fileName
240074240071
else
@@ -241887,7 +241884,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
241887241884
("In case of type error, check the type of '" ^ valueName
241888241885
^ "' in '"
241889241886
^ (fileName |> ModuleName.toString)
241890-
^ ".re'" ^ " and '"
241887+
^ ".res'" ^ " and '"
241891241888
^ (importPath |> ImportPath.emit)
241892241889
^ "'.")
241893241890
~early:true ~emitters ~name:valueNameTypeChecked ~type_
@@ -243649,9 +243646,9 @@ let processCmtFile cmt =
243649243646
let isInterface = Filename.check_suffix cmtFile ".cmti" in
243650243647
let resolver =
243651243648
ModuleResolver.createLazyResolver ~config
243652-
~extensions:[ ".re"; ".res"; EmitType.shimExtension ]
243649+
~extensions:[ ".res"; EmitType.shimExtension ]
243653243650
~excludeFile:(fun fname ->
243654-
fname = "React.re" || fname = "ReasonReact.re")
243651+
fname = "React.res" || fname = "ReasonReact.res")
243655243652
in
243656243653
let inputCMT, hasGenTypeAnnotations =
243657243654
let inputCMT = readCmt cmtFile in

0 commit comments

Comments
 (0)