Skip to content

Update typing system to separate types and properties - #63

Merged
TiarkRompf merged 2 commits into
mainfrom
typing-update
Nov 20, 2024
Merged

TiarkRompf merged 2 commits into
mainfrom
typing-update

Conversation

@IsaacFleetwood

Copy link
Copy Markdown
Contributor

Update the typing implementation to be consistent with the new typing rules outlined in the document.
Specifically:

  • Nothing no longer exists as a value type, it has been separated out into a separate properties (props) field.
  • The rules have been updated to propagate properties as stated in the typing rules.
  • Parameters have been rewritten to read better, and objects have been redefined to be an explicitly recursive definition instead of an array.

Still To-Do:

  • Determine consistent name for a value type versus a type tuple (tuple of a value type and its properties).
    Right now, the code is a bit all over the place for these names, given these once were the same thing.
  • Calculate type of filter variables by a pass over the entire AST before type checking. The type should be the fixpoint of the intersection of usages, as defined in the typing document.
  • Determine way of passing Non-Empty type guarantees to the compiler. This is necessary to give compile-time guarantees that object accesses will not return nothing. Importantly, this should include non-empty guarantee of not just keys but also intersection types.

Requested review from Ran given the work being done in the SQL-New codegen. Given the changes, it's likely this will require consolidation with other branches being worked on to fix certain breaking changes.

@TiarkRompf

TiarkRompf commented Nov 19, 2024 •

Copy link
Copy Markdown
Member

I'll let @guo543 comment as well, but I'd be otherwise ready to merge this.

Some purely cosmetic points:

  • let's stick to some uniform coding style regarding whitespace and use if (...), for (...) instead of if(...), for(...))
  • "nothing" is a better name for the empty type than "never"

@guo543

guo543 commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

Looks good! Thanks for also changing the sql codegen.

@TiarkRompf
TiarkRompf merged commit 26690e7 into main Nov 20, 2024
@guo543
guo543 deleted the typing-update branch October 20, 2026 15:48
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.

3 participants