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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

checker: warn about byte deprecation when used as fn param #19629

Merged
merged 4 commits into from Oct 23, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Oct 22, 2023

Currently the below won't inform about the byte deprecation

fn do_byte_things(should_warn byte) {}

With the changes it will warn, as the next one does:

b := byte(`b`)

馃 Generated by Copilot at 841f403

Changed the type of several variables and parameters related to string manipulation from byte to u8 in various modules. Added a warning to the checker module to inform the user that byte is deprecated and u8 should be used instead. These changes are part of a larger effort to remove the byte alias and use u8 consistently throughout the codebase.

馃 Generated by Copilot at 841f403

  • Replace the deprecated type alias byte with u8 in several places to avoid confusion and improve consistency (link, link, link, link, link)
  • Add a warning to the checker module when a function parameter has the type byte, advising the user to use u8 instead (link)

@ttytm ttytm force-pushed the checker/byte-dep-param-warn branch from 841f403 to 3753bee Compare October 23, 2023 04:54
Comment on lines 195 to +198
// TODO: remove when `byte` is removed
[markused]
fn encode_byte(root byte) &C.cJSON {
return encode_u8(u8(root))
fn encode_byte(root u8) &C.cJSON {
return encode_u8(root)
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm updating this one since usage is the same and without updating it every json test would need to be updated with the current implementation of the warning.

@ttytm ttytm marked this pull request as ready for review October 23, 2023 05:35
@spytheman spytheman merged commit 6437d82 into vlang:master Oct 23, 2023
51 checks passed
@ttytm ttytm deleted the checker/byte-dep-param-warn branch October 25, 2023 02:30
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.

None yet

3 participants