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

ast: When checking actual type par against constraints, do not walk through inh chain of choice Fix #3362 #3386

Merged
merged 4 commits into from
Jul 15, 2024

Conversation

fridis
Copy link
Member

@fridis fridis commented Jul 15, 2024

Since choice types cannot be called, the result of a call to choice X Y Z is void, which lead to choice types that inherit from choice to be accepted to match any constraint. This patch fixes this by not walking through the parents if the actual type parameter is a choice.

This also adds a regression test with the original code from #3362 and a minimalistic example.

…hrough inh chain of choice Fix #3362

Since choice types cannot be called, the result of a call to `choice X Y Z` is
`void`, which lead to choice types that inherit from choice to be accepted to
match any constraint. This patch fixes this by not walking through the parents
if the actual type parameter is a choice.

This also adds a regression test with the original code from #3362 and a minimalistic example.
@fridis fridis marked this pull request as draft July 15, 2024 10:28
Otherwise `option T`, which is a choice, would not be assignable to `Sequence
T`-
Otherwise `option T`, which is a choice, would not be assignable to `Sequence
T`-
@fridis fridis marked this pull request as ready for review July 15, 2024 10:46
@fridis fridis merged commit 79c0383 into main Jul 15, 2024
5 checks passed
@fridis fridis deleted the fix_3362 branch July 15, 2024 11:22
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