Skip to content

Add support for functions in untagged variants. - #6279

Merged
cristianoc merged 4 commits into
masterfrom
untagged_function
Jun 1, 2023
Merged

cristianoc merged 4 commits into
masterfrom
untagged_function

Conversation

@cristianoc

@cristianoc cristianoc commented May 31, 2023 •

Copy link
Copy Markdown
Collaborator

This was done at speed: need to double check that there are no corner cases missing.

Fixes #6278

TODO:

  • changelog
  • check corner cases: can this overlap with other cases etc
  • check gentype

This was done at speed: need to double check that there are no corner cases missing.

Fixes #6278
| ArrayType ->
not (is_array e)
| FunctionType ->
typeof e != function_

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Functions cannot overlap with literals so this case should be OK.

match tag_type with
| Untagged IntType
| Untagged StringType
| Untagged FloatType -> typeof y == x

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This seems OK as functions can't overlap with int, string, float, object, array.

@cristianoc
cristianoc requested a review from zth June 1, 2023 03:17

@zth zth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, this is great!

@fhammerschmidt

Copy link
Copy Markdown
Member

Works as expected!

@cristianoc
cristianoc merged commit 9afac86 into master Jun 1, 2023
@cristianoc
cristianoc deleted the untagged_function branch June 1, 2023 08:37
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.

Allow function type in untagged variants

3 participants