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

Where clauses #13

Merged
merged 5 commits into from
Aug 2, 2019
Merged

Where clauses #13

merged 5 commits into from
Aug 2, 2019

Conversation

asomers
Copy link
Owner

@asomers asomers commented Aug 2, 2019

  • Correctly handle where clauses on mocked methods.
  • Handle generic specializing methods
  • Document workaround for nongeneric specializing methods

It was already possible to mock a method with a where clause; the where
clause would simply be omitted from generated code.  But the code
wouldn't compile if some part of the signature required it.  For
example, constructor methods that returned generic structs with where
clauses on their generic parameters wouldn't work.  Now they do.

Fixes #5
Fixes #6
Merging Generics is required for specializing methods.  Non-generic
specializing methods aren't yet supported, but this commit is still
needed for some generic specializing methods.
A specializing method is a non-generic method of a generic struct that
places additional bounds on the struct's generic types via a where
clause.

Without trait specialization, it probably won't be possible for Mockall
to support specializing methods.  Instead, the method must be made
generic, just like static methods of generic structs.
@asomers asomers merged commit 2196c56 into master Aug 2, 2019
@asomers asomers deleted the where_clauses branch August 27, 2020 03:05
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.

None yet

1 participant