rems-project / sail

Sail architecture definition language
Other
631 stars 117 forks source link

Topsort fails if struct name conflicts with top level let binding #61

Closed rmn30 closed 4 years ago

rmn30 commented 4 years ago

The attached file fails to produce valid ocaml because of a problem with topological sorting:

./sail -ocaml config_fail.sail
+ ocamlfind ocamlc -c -g -package lem -package linksem -package zarith -o out.cmo out.ml
File "out.ml", line 10, characters 20-24:
10 | let zisa_config = ({zISA = true});;
                         ^^^^
Error: Unbound record field zISA
Command exited with code 2.
Compilation unsuccessful after building 6 targets (4 cached) in 00:00:00.
ocamlbuild -use-ocamlfind out.cmo terminated with code 10

The problem goes away if you remove the struct isa_config declaration, so the problem appears to be caused by a conflict between the name of the struct and the name of the top level let binding.

config_fail.sail.txt

rmn30 commented 4 years ago

48b058048c0cf7fae12345568b83166f42f116a2 fixes example above but attached example is still not fixed. config_fail2.sail.txt