-
Notifications
You must be signed in to change notification settings - Fork 52
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
KCL: No 'let' or 'const' required when declaring vars #4063
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
can you update the types doc its a manual doc of stuff like this in docs/kcl/types |
Done! |
64b2320
to
2250297
Compare
Just to test it works.
Also updates the Rust recaster tests.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4063 +/- ##
==========================================
+ Coverage 86.16% 86.21% +0.04%
==========================================
Files 75 75
Lines 26423 26454 +31
==========================================
+ Hits 22768 22806 +38
+ Misses 3655 3648 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The test was failing because 'myVar' could be found in two places, and it was told to just "click on 'myVar'". That wasn't ambiguous before when the code editor had `const myVar =` but now with the naked assignment, it is. Solution is to make it more specific and find 'myVar' in the code editor.
fd28685
to
6102a7f
Compare
Previously variable declaration required a keyword, e.g.
These were all valid, and did the exact same thing. As of this PR, they're all still valid, but the KCL formatter will change them all to just:
which is the new preferred way to declare a constant.
Screenshots demonstrate that
let
,const
,var
and naked declarations all work:But the formatter will remove the var/let/const keywords.
Closes #3985