Skip to content

Elaboration of subtyping rule of struct and variant in SpecTec IL#2111

Open
jihongmin63 wants to merge 4 commits intoWebAssembly:mainfrom
jihongmin63:subtyp
Open

Elaboration of subtyping rule of struct and variant in SpecTec IL#2111
jihongmin63 wants to merge 4 commits intoWebAssembly:mainfrom
jihongmin63:subtyp

Conversation

@jihongmin63
Copy link
Contributor

I elaborate the subtyping rule of struct and variant.

The current implementation did not strictly account for the premise-dropping behavior defined in the documentation. Specifically:

Variant types are in a subtype relation if the smaller type has fewer or the same number of cases, and for each of its cases there is an equivalent case in the larger type, except that the case in the larger type may drop some premises.

Record types are in a subtype relation if the larger type has fewer or the same number of fields, and for each of its fields there is an equivalent case in the smaller type, except that the field in the larger type may drop some premises.

So I categorized the premises for the smaller and the larger types, and revised the subtyping logic to ensure the larger type's premises are correctly contained within the smaller type's premises.
As there is no specific mention of this in the IL syntax, I would appreciate it if you could verify if this approach is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant