Add type validations for function imports#8478
Merged
stevenfontanella merged 2 commits intomainfrom Mar 18, 2026
Merged
Conversation
tlively
approved these changes
Mar 17, 2026
| } | ||
|
|
||
| if (auto** tableDecl = std::get_if<Table*>(&import)) { | ||
| } else if (auto** tableDecl = std::get_if<Table*>(&import)) { |
Member
There was a problem hiding this comment.
As a follow-up, it would be nice to give Importable a getKind method so we could use a switch here.
Member
Author
There was a problem hiding this comment.
We could use std::visit or switch on import.index() if that sounds good? I didn't use visit originally since there are a lot of variables that we'd have to capture from the outside. Is the idea to make the cases exhaustive?
Member
There was a problem hiding this comment.
Yes, to make it exhaustive and to make it easier to read (although that's subjective). I guess we would still need to cast to the relevant subtype, though, so maybe it's not worth it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validates that the exported function is a subtype of the import declaration. Part of #8261.
Example error: