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

fix: check the argument count of generic types #970

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Mar 9, 2023

Related issue(s)

Resolves the first part of #969

Description

Summary of changes

This PR issues an error when a type constructor is given an incorrect number of generic arguments. If these are not checked, we later fail an assert while instantiating struct types later on during type checking. To ensure we do not hit this assert even in the presence of bad input, we resize the generics vector on error. Either truncating it or filling it with fresh type variables until it is the desired size.

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

@TomAFrench TomAFrench changed the title Check the argument count of generic types fix: check the argument count of generic types Mar 9, 2023
@kevaundray kevaundray added this pull request to the merge queue Mar 9, 2023
Merged via the queue into master with commit 2688dc4 Mar 9, 2023
@kevaundray kevaundray deleted the jf/check-generic-type-argcount branch March 9, 2023 22:31
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.

2 participants