-
Notifications
You must be signed in to change notification settings - Fork 138
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 Value.Type() returning Type referencing nil ptr for eight external values #2388
Conversation
- changed some external value's Type() to check and return nil Type, instead of Type referencing nil pointer, such as nil *ResourceType. - changed type of Dictionary.DictionaryType from Type to *DictionaryType.
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 2e80137 Collapsed results for better readability
|
Codecov Report
@@ Coverage Diff @@
## master #2388 +/- ##
==========================================
+ Coverage 78.52% 78.55% +0.02%
==========================================
Files 316 316
Lines 68561 68596 +35
==========================================
+ Hits 53837 53885 +48
+ Misses 12925 12911 -14
- Partials 1799 1800 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Thanks for fixing this!
Unfortunately, introducing typed nils is too easy.
We should maybe add tests that avoid regressions for these functions, and in addition, prevent incorrect implementations in the future (e.g. by creating an empty instance of each Type
implementation, and then, as each nested type is automatically nil
, the a call to Type()
should be equal to the untyped nil (== nil
).
Let me try adding that.
Refactored the existing tests and unified them with similar tests for @fxamacker @SupunS Could you please have a look? |
@dsainati1 @SupunS Could you please have a(nother) look? 🙏 This would unblock Faye on #2364 |
Changes include:
Dictionary.DictionaryType
fromType
to*DictionaryType
.Type()
to check and return nilType
, instead ofType
referencing nil pointer for these external values:Dictionary
Struct
Resource
Attachment
Event
Contract
Enum
Function
Closes #2387
master
branchFiles changed
in the Github PR explorer