Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection types #28

Merged
merged 5 commits into from
Aug 3, 2021
Merged

Intersection types #28

merged 5 commits into from
Aug 3, 2021

Conversation

thekid
Copy link
Member

@thekid thekid commented Aug 2, 2021

Implements syntactic support for intersection types:

function fixture(Countable&Traversable $t) { ... }

See xp-framework/compiler#117 and https://wiki.php.net/rfc/pure-intersection-types

continue;
$t->components[]= $this->type0($parse, false);
} while ('|' === $parse->token->value);
} else if ('&' === $parse->token->value) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The RFC states:

This means it would not be possible to mix intersection and union types together such as A&B|C, this is left as a future scope.

This is why it's OK to check for | and for & but not to check for the respective other after parsing

@thekid thekid merged commit d2f672a into master Aug 3, 2021
@thekid thekid deleted the feature/intersection-types branch August 3, 2021 10:42
@thekid
Copy link
Member Author

thekid commented Aug 3, 2021

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.

1 participant