Constructed Types and subtyping

Issue #470 resolved
Bart Bogaerts created an issue

Constructed types and subtyping is unpredictable The intended behavior should be * declared * documented * implemented

see for example the weird behavior in the attachment

Comments (7)

  1. Bart Bogaerts reporter

    Also, in cases that are not handled, the exceptions should be more clear:

    not "Addition of domain elements to a constructed sort is not yet implemented." but "subtypes of constructed types are not supported" or something like that

  2. JoD

    Solved by not allowing any constructed type to be a subtype, and only allowing other types to be declared as a subtype of a constructed type. E.g.:

    type T isa T2 constructed from {...}

    type T constructed from {...} contains T2

    type T constructed from {...} | type T2 contains T

    are NOT allowed, but:

    type T constructed from {...} | type T2 isa T

    IS allowed.

  3. JoD

    Remark: fix includes not enabling "isa" or "contains" in conjunction with "constructed from" by the parser. So you will get a parsing error in those cases. An "not allowed to use constructed types as subtype"-error will be thrown in the case of "T2 contains ConstrType".

  4. Log in to comment