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
Improve reference expressions #1661
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1661 +/- ##
=======================================
Coverage 77.43% 77.43%
=======================================
Files 305 305
Lines 62552 62546 -6
=======================================
- Hits 48437 48434 -3
+ Misses 12494 12492 -2
+ Partials 1621 1620 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 5a06fec Results
|
require.IsType(t, &sema.UnnecessaryCastHint{}, hints[0]) | ||
castHint := hints[0].(*sema.UnnecessaryCastHint) |
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.
👌
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.
We also need to update the docs
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.
Awesome!
Turns out, this also fixes a bug in the parser: https://github.com/onflow/cadence/pull/1661/files#diff-62e34e916aed6bc25eed273b0edbb3c0fc078de38bec85ed1fb4d034fc65b6cdR2428-R2429 Kudos to themasterpiece.art for reporting this bug. |
Merging, now that onflow/flow#941 has been accepted |
Description
This PR implements the FLIP proposing to improve reference expressions:
&v
. This turns existing cases of&v as &T
into a casting expression, a static type annotationas
, a variable declaration type annotationThese changes essentially make references behave exactly like empty container literals (empty array
[]
and empty dictionary{}
), unifying the concepts and allowing the intuition that developers gained there to be applied for references, too.In addition it keeps all current code working as before.
master
branchFiles changed
in the Github PR explorer