Skip to content

Commit cd827e3

Browse files
committed
Merge branch 'master' into autocomplete-null-nullable
2 parents cd45158 + 22f68af commit cd827e3

File tree

5 files changed

+72
-8
lines changed

5 files changed

+72
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#### :bug: Bug fix
2222

2323
- 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
24+
- Fix generation of interfaces for module types containing multiple type constraints. https://github.com/rescript-lang/rescript/pull/7825
2425

2526
#### :memo: Documentation
2627

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,36 @@ To generate the html:
339339
../scripts/ninja docs
340340
```
341341

342+
## Contribute to JSX `domProps`
343+
344+
The `domProps` type, defined in [packages/@rescript/runtime/JsxDOM.res](packages/@rescript/runtime/JsxDOM.res), dictates which properties can be used on DOM elements. This list isn't exhaustive, so you might want to contribute a missing prop.
345+
346+
Adding a new entry there requires re-running the analysis tests. Follow these steps:
347+
348+
1. Compile your changes:
349+
```bash
350+
make lib
351+
```
352+
2. (Optional) If your local compiler is outdated, rebuild:
353+
```bash
354+
make build
355+
```
356+
3. Run the analysis tests. This will likely fail due to an outdated autocomplete test snapshot:
357+
```bash
358+
make test-analysis
359+
```
360+
4. Add the updated snapshot to Git:
361+
```bash
362+
git add tests/analysis_tests
363+
```
364+
5. Re-run the analysis tests. They should now pass:
365+
```bash
366+
make test-analysis
367+
```
368+
369+
(If a `make` command fails, consider using the [DevContainer](#b-devcontainer).)
370+
371+
Finally, add a line to [CHANGELOG.md](CHANGELOG.md), using the `#### :nail_care: Polish` section.
342372
## Code structure
343373

344374
The highlevel architecture is illustrated as below:

compiler/syntax/src/res_outcome_printer.ml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,18 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) =
217217
Doc.join ~sep:Doc.line
218218
((List.map2 [@doesNotRaise])
219219
(fun lbl typ ->
220-
Doc.concat
221-
[
222-
Doc.text
223-
(if i.contents > 0 then "and type " else "with type ");
224-
Doc.text lbl;
225-
Doc.text " = ";
226-
print_out_type_doc typ;
227-
])
220+
let result =
221+
Doc.concat
222+
[
223+
Doc.text
224+
(if i.contents > 0 then "and type " else "with type ");
225+
Doc.text lbl;
226+
Doc.text " = ";
227+
print_out_type_doc typ;
228+
]
229+
in
230+
incr i;
231+
result)
228232
labels types)
229233
in
230234
Doc.indent (Doc.concat [Doc.line; package])

tests/analysis_tests/tests/src/CreateInterface.res

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,24 @@ module ComponentWithPolyProp = {
171171
<div className />
172172
}
173173
}
174+
175+
module OrderedSet = {
176+
type t<'a, 'identity> = {
177+
cmp: ('a, 'a) => int,
178+
set: Belt.Set.t<'a, 'identity>,
179+
array: array<'a>,
180+
}
181+
182+
let make = (
183+
type value identity,
184+
~id: module(Belt.Id.Comparable with type t = value and type identity = identity),
185+
): t<value, identity> => {
186+
let module(M) = id
187+
188+
{
189+
cmp: M.cmp->Belt.Id.getCmpInternal,
190+
set: Belt.Set.make(~id),
191+
array: [],
192+
}
193+
}
194+
}

tests/analysis_tests/tests/src/expected/CreateInterface.res.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,12 @@ module ComponentWithPolyProp: {
124124
@react.component
125125
let make: (~size: [< #large | #small]=?) => Jsx.element
126126
}
127+
module OrderedSet: {
128+
type t<'a, 'identity> = {
129+
cmp: ('a, 'a) => int,
130+
set: Belt.Set.t<'a, 'identity>,
131+
array: array<'a>,
132+
}
133+
let make: (~id: module(Belt.Id.Comparable with type identity = 'a and type t = 'b)) => t<'b, 'a>
134+
}
127135

0 commit comments

Comments
 (0)