Skip to content

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

Merged
spytheman merged 4 commits into
vlang:masterfrom
ttytm:checker/byte-dep-param-warn
Oct 23, 2023
Merged

spytheman merged 4 commits into
vlang:masterfrom
ttytm:checker/byte-dep-param-warn

Conversation

@ttytm

@ttytm ttytm commented Oct 22, 2023 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
@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.

3 participants