Allow native functions to have type parameters#2850
Merged
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. |
dsainati1
approved these changes
Oct 5, 2023
6 tasks
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.
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
Testcontract, to improve its API.masterbranchFiles changedin the Github PR explorer