Skip to content
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

node tag .identifier != token tag .identifier, eg @Some #1655

Closed
wants to merge 2 commits into from

Conversation

llogick
Copy link
Contributor

@llogick llogick commented Dec 6, 2023

fixes #1645

@SuperAuguste
Copy link
Member

This is @Techatrix's worse enemy :P

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (5c0bebe) 76.12% compared to head (6170acd) 76.12%.

Files Patch % Lines
src/analysis.zig 82.35% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1655   +/-   ##
=======================================
  Coverage   76.12%   76.12%           
=======================================
  Files          34       34           
  Lines       10007    10003    -4     
=======================================
- Hits         7618     7615    -3     
+ Misses       2389     2388    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Techatrix Techatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a new test case?

@llogick
Copy link
Contributor Author

llogick commented Dec 6, 2023

I've felt like reworking identifierTokenToNameSlice and related to do the check(s) and return an error/null every time it has happened and I just might, because it also affects const Self = @This;.

Could you add a new test case?

What would it look like?

@llogick llogick force-pushed the nullptrdevs/node-tag-id-noteql-tok-tag-id branch from eec8061 to 17e2893 Compare December 6, 2023 19:06
@Techatrix
Copy link
Member

I've felt like reworking identifierTokenToNameSlice and related to do the check(s) and return an error/null every time it has happened and I just might, because it also affects const Self = @This;.

How about making identifierTokenToNameSlice support zig.tokenizer.Token.Tag.builtin and make it return @This when called on a @This token.

What would it look like?

Convert the code in #1645 into a semantic token test and reduce its size while ensuring that its still hits the assertion.

@llogick
Copy link
Contributor Author

llogick commented Dec 6, 2023

How about making identifierTokenToNameSlice support zig.tokenizer.Token.Tag.builtin and make it return @This when called on a @This token.

I did consider special casing it in resolveType, but it is an incomplete expr => compile error, and in the case of const Self = @This; it gets passed to lookupSymbolGlobal which is plain wrong.

@llogick llogick force-pushed the nullptrdevs/node-tag-id-noteql-tok-tag-id branch from 17e2893 to 44b55a8 Compare December 6, 2023 20:15
@Techatrix
Copy link
Member

I did consider special casing it in resolveType, but it is an incomplete expr => compile error, and in the case of const Self = @This; it gets passed to lookupSymbolGlobal which is plain wrong.

Then have it return null and adjust the return type?

@llogick
Copy link
Contributor Author

llogick commented Dec 6, 2023

Then have it return null and adjust the return type?

Which function?

@Techatrix
Copy link
Member

identifierTokenToNameSlice and all other variants

@llogick
Copy link
Contributor Author

llogick commented Dec 6, 2023

identifierTokenToNameSlice and all other variants

I think it's better to be aware that they might fail + code(checks) dedup.

@llogick
Copy link
Contributor Author

llogick commented Dec 9, 2023

I went with errors, returning null felt vague and forced.

@llogick llogick force-pushed the nullptrdevs/node-tag-id-noteql-tok-tag-id branch from 6e6d754 to 6170acd Compare December 24, 2023 04:11
@llogick llogick closed this Jan 8, 2024
@llogick llogick deleted the nullptrdevs/node-tag-id-noteql-tok-tag-id branch February 4, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zls crashes
3 participants