Skip to content

Commit 799eb1d

Browse files
authored
Fix compiler crash with unboxed types with only 1 constructor. (#6523)
Fixes #6519
1 parent 6153179 commit 799eb1d

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Fix accidental removal of `Belt.Result.Ok` and `Belt.Result.Error` constructors in rc.5 https://github.com/rescript-lang/rescript-compiler/pull/6514
2121
- Add missing check that the runtime representation of variants matches implementation and interface. https://github.com/rescript-lang/rescript-compiler/pull/6513/files
2222
- GenType: only export types (not values) from module types. https://github.com/rescript-lang/rescript-compiler/pull/6516
23+
- Fix compiler crash with unboxed variant definition with only 1 constructor. https://github.com/rescript-lang/rescript-compiler/pull/6523
2324

2425
# 11.0.0-rc.7
2526

jscomp/ml/typedecl.ml

+2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ let transl_declaration ~typeRecordAsObject env sdecl id =
337337
end;
338338
let unboxed_status =
339339
match sdecl.ptype_kind with
340+
| Ptype_variant [{pcd_args = Pcstr_tuple []; _}] ->
341+
unboxed_false_default_false
340342
| Ptype_variant [{pcd_args = Pcstr_tuple _; _}]
341343
| Ptype_variant [{pcd_args = Pcstr_record
342344
[{pld_mutable = Immutable; _}]; _}]

jscomp/test/UntaggedVariants.js

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

jscomp/test/UntaggedVariants.res

+5
Original file line numberDiff line numberDiff line change
@@ -427,3 +427,8 @@ module Aliased = {
427427
}
428428
}
429429
}
430+
431+
module OnlyOne = {
432+
@unboxed type onlyOne = OnlyOne
433+
let onlyOne = OnlyOne
434+
}

0 commit comments

Comments
 (0)