Skip to content

Typecheck labeled tuple terms#1502

Merged
ccasin merged 5 commits intooxcaml:labeled-tuplesfrom
rtjoa:lt-type-terms-merged
Jun 22, 2023
Merged

Typecheck labeled tuple terms#1502
ccasin merged 5 commits intooxcaml:labeled-tuplesfrom
rtjoa:lt-type-terms-merged

Conversation

@rtjoa
Copy link
Copy Markdown
Contributor

@rtjoa rtjoa commented Jun 15, 2023

Summary

  • Typecheck labeled tuple terms, e.g. ~~(~x: 1, "hi") as x: int * string
  • Ensures tuple types match when unifying
  • Implementation: adds a string option * to the element types of Texp_tuple's and TTuples's lists

Testing

Added testcases to ocaml/testsuite/tests/typing-labeled-tuples/labeledtuples.ml.

Printtyp.raw_type_expr was tested via the debugger.

The type of the value ~~(~lbl:5, "hi") prints as:

Ttuple
        [label="lbl" {id=114;level=100000000;scope=0;desc=Tconstr(int,[],[])};
         {id=115;level=100000000;scope=0;desc=Tconstr(string,[],[])}]};

@rtjoa rtjoa force-pushed the lt-type-terms-merged branch from 6cc8c3c to ec00b16 Compare June 20, 2023 15:32
Copy link
Copy Markdown
Collaborator

@ccasin ccasin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I have a bunch of minor suggestions, but didn't spot any big issues.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants