BUG: Phantom (undefined) ad-hoc type reference created when applying `conv` to `mu`
Encodings that are defined by applying a conv
combinator to an encoding defined using a mu
combinator may lead to aberrant behavior in which the main encoding is described as a reference to a "phantom" type with no corresponding definition, with the actual type it is defined as included under its original name.
Steps to reproduce:
- Apply changes made in !49 (closed) (Main test file attached below)
- Execute
dune runtest
at project root - Inspect output file
_build/default/test/_build/_tests/tezos-data-encoding/conv_mu.000.output
If the bug has not been fixed, the output should resemble the following:
{ "toplevel":
{ "fields":
[ { "layout": { "name": "X_1", "kind": "Ref" }, "kind": "anon",
"data_kind": { "kind": "Dynamic" } } ] },
"fields":
[ { "description": { "title": "boollist" },
"encoding":
{ "tag_size": "Uint8", "kind": { "kind": "Dynamic" },
"cases":
[ { "tag": 0,
"fields":
[ { "name": "Tag",
"layout": { "size": "Uint8", "kind": "Int" },
"data_kind": { "size": 1, "kind": "Float" },
"kind": "named" },
{ "layout": { "kind": "Zero_width" }, "kind": "anon",
"data_kind": { "size": 0, "kind": "Float" } } ],
"name": "Nil" },
{ "tag": 1,
"fields":
[ { "name": "Tag",
"layout": { "size": "Uint8", "kind": "Int" },
"data_kind": { "size": 1, "kind": "Float" },
"kind": "named" },
{ "name": "head", "layout": { "kind": "Bool" },
"data_kind": { "size": 1, "kind": "Float" },
"kind": "named" },
{ "name": "tail",
"layout": { "name": "boollist", "kind": "Ref" },
"data_kind": { "kind": "Dynamic" }, "kind": "named" } ],
"name": "Cons" } ] } } ] }
Note that the toplevel type is defined to be a reference to X_1
, which is a phantom type with no provided definition; the proper definition should be a reference to boollist
.