Skip to content

Fatal error: exception Whole_compiler.Ctype.Unify(_) #4009

Closed
@chenglou

Description

@chenglou

Repro:

type nonrec 'label frame = {
  next: int }
type 'label t = {
  timeline: 'label frame array ;
  label: 'label }
let step person = { person with label = (ref person.label) }

Compiler output:

yarn run v1.9.4
$ bsb -make-world
[3/3] Building src/demo.cmj
FAILED: src/demo.cmj src/demo.cmi /Users/chenglou/Desktop/foo/src/demo.bs.js 
/Users/chenglou/.config/yarn/global/node_modules/bs-platform/lib/bsc.exe -nostdlib -bs-package-name foo  -bs-package-output commonjs:src -color always -bs-suffix -I src -I /Users/chenglou/Desktop/foo/node_modules/bs-platform/lib/ocaml -w -30-40+6+7+27+32..39+44+45+101 -warn-error +101  -o src/demo.cmj src/demo.mlast
Fatal error: exception Whole_compiler.Ctype.Unify(_)
Raised at file "ctype.ml", line 2797, characters 6-45
Called from file "typecore.ml", line 3016, characters 18-62
Called from file "array.ml", line 101, characters 21-40
Called from file "typecore.ml", line 3020, characters 36-68
Called from file "builtin_attributes.ml", line 165, characters 14-18
Re-raised at file "builtin_attributes.ml", line 170, characters 4-13
Called from file "typecore.ml", line 2610, characters 4-146
Called from file "typecore.ml", line 4584, characters 18-63
Called from file "list.ml", line 121, characters 32-39
Called from file "typecore.ml", line 4562, characters 4-1023
Called from file "typecore.ml", line 3722, characters 4-86
Called from file "builtin_attributes.ml", line 165, characters 14-18
Re-raised at file "builtin_attributes.ml", line 170, characters 4-13
Called from file "typecore.ml", line 2610, characters 4-146
Called from file "builtin_attributes.ml", line 165, characters 14-18
Re-raised at file "builtin_attributes.ml", line 170, characters 4-13
Called from file "list.ml", line 121, characters 32-39
Called from file "typecore.ml", line 4774, characters 4-1023
Called from file "typecore.ml", line 4851, characters 4-185
Called from file "typemod.ml", line 1426, characters 10-56
Called from file "typemod.ml", line 1653, characters 32-59
Called from file "typemod.ml", line 1657, characters 44-68
Called from file "typemod.ml", line 1657, characters 44-68
Called from file "typemod.ml", line 1665, characters 33-53
Called from file "builtin_attributes.ml", line 165, characters 14-18
Re-raised at file "builtin_attributes.ml", line 170, characters 4-13
Called from file "typemod.ml" (inlined), line 1685, characters 21-46
Called from file "typemod.ml", line 1788, characters 4-64
Re-raised at file "typemod.ml", line 1848, characters 4-11
Called from file "js_implementation.ml", line 170, characters 8-178
Called from file "arg.ml", line 261, characters 11-20
Called from file "arg.ml" (inlined), line 272, characters 2-84
Called from file "arg.ml" (inlined), line 276, characters 2-72
Called from file "arg.ml", line 281, characters 4-31
Called from file "js_main.ml", line 353, characters 4-49
Re-raised at file "location.ml", line 472, characters 14-25
Re-raised at file "location.ml", line 472, characters 14-25
Re-raised at file "location.ml", line 472, characters 14-25
Re-raised at file "location.ml", line 472, characters 14-25
Re-raised at file "location.ml", line 472, characters 14-25
Re-raised at file "location.ml", line 472, characters 14-25
Called from file "location.ml" (inlined), line 477, characters 31-61
Called from file "js_main.ml", line 357, characters 6-37
FAILED: subcommand failed.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Instead, it should correctly fail to type check (solution is to remove the ref in the last line)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions