-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add support for dereferencing optional references #3008
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 24f277e Collapsed results for better readability
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3008 +/- ##
=======================================
Coverage 80.00% 80.00%
=======================================
Files 356 356
Lines 83043 83069 +26
=======================================
+ Hits 66437 66463 +26
Misses 14247 14247
Partials 2359 2359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Does this only unwrap optionals one layer? I.e. will |
Yes, only one layer of optionality is unwrapped, just like the optional chaining version did. This is also similar to how e.g. To be honest, this is already quite some syntactic sugar, maybe we shouldn't even have this? For example, the current behaviour is just |
Yeah, that makes sense.
IMO this is useful for the same reason that optional chaining is; it makes a common case more convenient to use. You're right that this is doable another way, but it would probably be more frustrating to do that way. The same is true for optional chaining! I'm happy with this only unwrapping one layer of the optional. |
Good point, agreed! |
Closes #3005
master
branchFiles changed
in the Github PR explorer