-
Notifications
You must be signed in to change notification settings - Fork 137
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
Allow native functions to have type parameters #2850
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 9cfaef5 Collapsed results for better readability
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2850 +/- ##
==========================================
+ Coverage 79.38% 79.40% +0.02%
==========================================
Files 334 334
Lines 78826 78914 +88
==========================================
+ Hits 62576 62664 +88
+ Misses 13944 13943 -1
- Partials 2306 2307 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Description
Even though supporting "user functions" to have type parameters still needs more work, at least allow native functions to have type parameters.
We already declare and implement built-in functions with type parameters, manually or using the Go type code generator. This PR just extends the existing support to the type checker, so it can be used for checking native/built-in functions.
This PR is basically a subset of #2463, but instead of allowing any function to be generic, it restricts it to native functions, and keeps support for parsing type parameters in function declarations behind a feature flag.
This will allow us to declare more of the built-in types and functions in Cadence code, instead of manually declaring types in Go code, or using the Go type code generator. Concretely, this feature is planned to be used in the
Test
contract, to improve its API.master
branchFiles changed
in the Github PR explorer