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

[bugfix] Check #TypeArgs == #TypeParams for TypeDefs as well as OpDefs #342

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Aug 3, 2023

The code was in there, but seemingly in the wrong place. Not sure if my comment on TypeArgError::WrongNumber had mislead so I've corrected that ;)

@acl-cqc acl-cqc requested a review from ss2165 August 3, 2023 09:49
src/resource.rs Outdated
def.instantiate_concrete([TypeArg::HashableType(HashableType::String)])
.unwrap_err();
// Too few arguments:
def.instantiate_concrete([]).unwrap_err();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was previously panicking with an index-out-of-bounds in computing the tag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(If I'd provided a TypeDefTag::Explicit it would have just returned a CustomType)

src/resource.rs Outdated
Comment on lines 724 to 733
def.instantiate_concrete([TypeArg::HashableType(HashableType::String)])
.unwrap_err();
// Too few arguments:
def.instantiate_concrete([]).unwrap_err();
// Too many arguments:
def.instantiate_concrete([
TypeArg::ClassicType(ClassicType::F64),
TypeArg::ClassicType(ClassicType::F64),
])
.unwrap_err();
Copy link
Member

Choose a reason for hiding this comment

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

can we assert_matches on some known errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can. They'll change in an upcoming PR but yeah, ok

Copy link
Member

Choose a reason for hiding this comment

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

ah, in which case some TODOs should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They'll be simple updates, and it'll make the change obvious and explicit, so done.

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

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

👍 thanks

@acl-cqc acl-cqc added this pull request to the merge queue Aug 3, 2023
Merged via the queue into main with commit 5cb354a Aug 3, 2023
5 checks passed
@acl-cqc acl-cqc deleted the bugfix/typedef_num_args branch August 3, 2023 10:43
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