2024-11-24 13:14 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000528mercuryBugpublic2021-01-30 01:46
Reporterdirkz 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformMercury 20.06 / rotd-2021-01-27OSMacOS Catalina, IntelOS Version10.15.7
Product Version 
Target VersionFixed in Version 
Summary0000528: Compiler aborts when constructing invalid inst
DescriptionI want Mercury's mode checker to enforce following HTML validation rules via insts:
- An ul tag (unordered list) allows only li tags (list item) as direct children
- An li tag must have an ol tag as immediate parent

Expected result:
Compiler should report an error when creating an invalid inst.

Actual result:
Compiler aborts.

The error occurs with Mercury 20.06 as well as with rotd-2021-01-27.
Steps To Reproducemmc --make html
Additional Information$ mmc --make html
Making Mercury/int3s/html.int3
Making Mercury/ints/html.int
Making Mercury/cs/html.c
Uncaught Mercury exception:
Software Error: map.det_insert: key already present
    Key Type: parse_tree.prog_data.inst_name
    Key Value: user_inst(qualified(unqualified("html"), "non_empty_list"), [defined_inst(user_inst(qualified(unqualified("html"), "top_body_elem"), []))])
    Value Type: list.list(parse_tree.error_util.format_component)
** Error making `Mercury/cs/html.c'.
TagsNo tags attached.
Attached Files
  • ? file icon html.m (1,907 bytes) 2021-01-29 21:40

-Relationships
+Relationships

-Notes

~0001129

zs (developer)

I am testing a fix now.

However, if I were you, I would choose a HTML representation that
encoded HTML's invariants in the type, not in the mode. It would
not have any representation for
  • tags at all. Instead, the function
    symbol for lists would look like this:

    :- type html_elem
      ---> list(html_elem, list(html_elem))
      ...

    The
  • tags would be added only when a list is unparsed.
    (Not having an explicit representation for
  • guarantees
    that this representation cannot be put anywhere it shouldn't :-)
    And storing the first element of the list separately guarantees
    that the empty list is not representable.
  • ~0001130

    zs (developer)

    Sorry about the formatting of the above note. I didn't realize
    that Mantis does not quote html in notes :-( Those bullets were
    originally a sequence of <, l, i, and >.

    ~0001131

    zs (developer)

    Fix committed 2021 Jan 30.
    +Notes

    -Issue History
    Date Modified Username Field Change
    2021-01-29 21:40 dirkz New Issue
    2021-01-29 21:40 dirkz File Added: html.m
    2021-01-30 01:25 zs Assigned To => zs
    2021-01-30 01:25 zs Status new => assigned
    2021-01-30 01:34 zs Note Added: 0001129
    2021-01-30 01:36 zs Note Added: 0001130
    2021-01-30 01:46 zs Status assigned => resolved
    2021-01-30 01:46 zs Resolution open => fixed
    2021-01-30 01:46 zs Note Added: 0001131
    +Issue History