Skip to content

Commit b3ed5c8

Browse files
authored
Minor gentype fixes (#7109)
* Fix gentype error message (.rei -> .resi) * Fix deprecation warnings in gentype example * Gentype example: String.t -> string (preparation for Core)
1 parent 40e15c8 commit b3ed5c8

File tree

5 files changed

+2
-97
lines changed

5 files changed

+2
-97
lines changed

compiler/gentype/GenTypeMain.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ let process_cmt_file cmt =
135135
Log_.Color.setup ();
136136
Log_.info ~loc ~name:"Warning genType" (fun ppf () ->
137137
Format.fprintf ppf
138-
"Annotation is ignored as there's a .rei file"));
138+
"Annotation is ignored as there's a .resi file"));
139139
true)
140140
else false)
141141
in

tests/gentype_tests/typescript-react-example/src/ImmutableArray.res

-19
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ module Array = {
4343

4444
let rangeBy = (x, y, ~step) => Array.rangeBy(x, y, ~step)->toT
4545

46-
let makeByU = (c, f) => Array.makeByU(c, f)->toT
4746
let makeBy = (c, f) => Array.makeBy(c, x => f(x))->toT
4847

49-
let makeByAndShuffleU = (c, f) => Array.makeByAndShuffleU(c, f)->toT
5048
let makeByAndShuffle = (c, f) => Array.makeByAndShuffle(c, x => f(x))->toT
5149

5250
let zip = (a1, a2) => Array.zip(fromT(a1), fromT(a2))->toTp
5351

54-
let zipByU = (a1, a2, f) => Array.zipByU(fromT(a1), fromT(a2), f)->toT
5552
let zipBy = (a1, a2, f) => Array.zipBy(fromT(a1), fromT(a2), (x, y) => f(x, y))->toT
5653

5754
let unzip = a => Array.unzip(a->fromTp)->toT2
@@ -66,53 +63,37 @@ module Array = {
6663

6764
let copy = a => Array.copy(a->fromT)->toT
6865

69-
let forEachU = (a, f) => Array.forEachU(a->fromT, f)
7066
let forEach = (a, f) => Array.forEach(a->fromT, x => f(x))
7167

72-
let mapU = (a, f) => Array.mapU(a->fromT, f)->toT
7368
let map = (a, f) => Array.map(a->fromT, x => f(x))->toT
7469

75-
let keepWithIndexU = (a, f) => Array.keepWithIndexU(a->fromT, f)->toT
7670
let keepWithIndex = (a, f) => Array.keepWithIndex(a->fromT, (x, y) => f(x, y))->toT
7771

78-
let keepMapU = (a, f) => Array.keepMapU(a->fromT, f)->toT
7972
let keepMap = (a, f) => Array.keepMap(a->fromT, x => f(x))->toT
8073

81-
let forEachWithIndexU = (a, f) => Array.forEachWithIndexU(a->fromT, f)
8274
let forEachWithIndex = (a, f) => Array.forEachWithIndex(a->fromT, (x, y) => f(x, y))
8375

84-
let mapWithIndexU = (a, f) => Array.mapWithIndexU(a->fromT, f)->toT
8576
let mapWithIndex = (a, f) => Array.mapWithIndex(a->fromT, (x, y) => f(x, y))->toT
8677

87-
let partitionU = (a, f) => Array.partitionU(a->fromT, f)->toT2
8878
let partition = (a, f) => Array.partition(a->fromT, x => f(x))->toT2
8979

90-
let reduceU = (a, b, f) => Array.reduceU(a->fromT, b, f)
9180
let reduce = (a, b, f) => Array.reduce(a->fromT, b, (x, y) => f(x, y))
9281

93-
let reduceReverseU = (a, b, f) => Array.reduceReverseU(a->fromT, b, f)
9482
let reduceReverse = (a, b, f) => Array.reduceReverse(a->fromT, b, (x, y) => f(x, y))
9583

96-
let reduceReverse2U = (a1, a2, c, f) => Array.reduceReverse2U(fromT(a1), fromT(a2), c, f)
9784
let reduceReverse2 = (a1, a2, c, f) =>
9885
Array.reduceReverse2(fromT(a1), fromT(a2), c, (x, y, z) => f(x, y, z))
9986

100-
let someU = (a, f) => Array.someU(a->fromT, f)
10187
let some = (a, f) => Array.some(a->fromT, x => f(x))
10288

103-
let everyU = (a, f) => Array.everyU(a->fromT, f)
10489
let every = (a, f) => Array.every(a->fromT, x => f(x))
10590

106-
let every2U = (a1, a2, f) => Array.every2U(fromT(a1), fromT(a2), f)
10791
let every2 = (a1, a2, f) => Array.every2(fromT(a1), fromT(a2), (x, y) => f(x, y))
10892

109-
let some2U = (a1, a2, f) => Array.some2U(fromT(a1), fromT(a2), f)
11093
let some2 = (a1, a2, f) => Array.some2(fromT(a1), fromT(a2), (x, y) => f(x, y))
11194

112-
let cmpU = (a1, a2, f) => Array.cmpU(fromT(a1), fromT(a2), f)
11395
let cmp = (a1, a2, f) => Array.cmp(fromT(a1), fromT(a2), (x, y) => f(x, y))
11496

115-
let eqU = (a1, a2, f) => Array.eqU(fromT(a1), fromT(a2), f)
11697
let eq = (a1, a2, f) => Array.eq(fromT(a1), fromT(a2), (x, y) => f(x, y))
11798
}
11899

tests/gentype_tests/typescript-react-example/src/ImmutableArray.res.js

-57
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gentype_tests/typescript-react-example/src/ImmutableArray.resi

-19
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,12 @@ let range: (int, int) => t<int>
3838

3939
let rangeBy: (int, int, ~step: int) => t<int>
4040

41-
let makeByU: (int, int => 'a) => t<'a>
4241
let makeBy: (int, int => 'a) => t<'a>
4342

44-
let makeByAndShuffleU: (int, int => 'a) => t<'a>
4543
let makeByAndShuffle: (int, int => 'a) => t<'a>
4644

4745
let zip: (t<'a>, t<'b>) => t<('a, 'b)>
4846

49-
let zipByU: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>
5047
let zipBy: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>
5148

5249
let unzip: t<('a, 'a)> => (t<'a>, t<'a>)
@@ -61,50 +58,34 @@ let sliceToEnd: (t<'a>, int) => t<'a>
6158

6259
let copy: t<'a> => t<'a>
6360

64-
let forEachU: (t<'a>, 'a => unit) => unit
6561
let forEach: (t<'a>, 'a => unit) => unit
6662

67-
let mapU: (t<'a>, 'a => 'b) => t<'b>
6863
let map: (t<'a>, 'a => 'b) => t<'b>
6964

70-
let keepWithIndexU: (t<'a>, ('a, int) => bool) => t<'a>
7165
let keepWithIndex: (t<'a>, ('a, int) => bool) => t<'a>
7266

73-
let keepMapU: (t<'a>, 'a => option<'b>) => t<'b>
7467
let keepMap: (t<'a>, 'a => option<'b>) => t<'b>
7568

76-
let forEachWithIndexU: (t<'a>, (int, 'a) => unit) => unit
7769
let forEachWithIndex: (t<'a>, (int, 'a) => unit) => unit
7870

79-
let mapWithIndexU: (t<'a>, (int, 'a) => 'b) => t<'b>
8071
let mapWithIndex: (t<'a>, (int, 'a) => 'b) => t<'b>
8172

82-
let partitionU: (t<'a>, 'a => bool) => (t<'a>, t<'a>)
8373
let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)
8474

85-
let reduceU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b
8675
let reduce: (t<'a>, 'b, ('b, 'a) => 'b) => 'b
8776

88-
let reduceReverseU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b
8977
let reduceReverse: (t<'a>, 'b, ('b, 'a) => 'b) => 'b
9078

91-
let reduceReverse2U: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c
9279
let reduceReverse2: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c
9380

94-
let someU: (t<'a>, 'a => bool) => bool
9581
let some: (t<'a>, 'a => bool) => bool
9682

97-
let everyU: (t<'a>, 'a => bool) => bool
9883
let every: (t<'a>, 'a => bool) => bool
9984

100-
let every2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool
10185
let every2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool
10286

103-
let some2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool
10487
let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool
10588

106-
let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int
10789
let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int
10890

109-
let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
11091
let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool

tests/gentype_tests/typescript-react-example/src/nested/Types.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type opaqueVariant =
4949
| A
5050
| B
5151

52-
@genType let stringT: String.t = "a"
52+
@genType let stringT: string = "a"
5353

5454
@genType let jsStringT: Js.String.t = "a"
5555

0 commit comments

Comments
 (0)