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

checker: check fn call argument mismatch (fix #23016) #23061

Merged
merged 6 commits into from
Dec 4, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Dec 4, 2024

This PR check fn call argument mismatch (fix #23016).

  • Check fn call argument mismatch.
  • Add test.
fn f(x int) {
	println(x)
}

fn main() {
	x := u32(2251797157)
	println(x)
	f(x)
}

PS D:\Test\v\tt1> v run .
tt1.v:8:4: error: cannot use `u32` as `int` in argument 1 to `f`
    6 |     x := u32(2251797157)
    7 |     println(x)
    8 |     f(x)
      |       ^
    9 | }

Huly®: V_0.6-21501

@spytheman
Copy link
Member

Excellent work!
It already found potential bugs 🥳 .

@spytheman
Copy link
Member

@yuyi98, perhaps it should be a notice for a few weeks, then we can turn it to an error again.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Thank you!

@spytheman
Copy link
Member

spytheman commented Dec 4, 2024

Hm, turning it into a notice will also affect the other conversions 🤔 .
Perhaps we should just fix the affected projects on the CI right away.

@spytheman
Copy link
Member

I'll fix msgpack first.

spytheman added a commit to vlang/adventofcode that referenced this pull request Dec 4, 2024
spytheman added a commit to spytheman/discord.v-1 that referenced this pull request Dec 4, 2024
spytheman added a commit to vlang/coreutils that referenced this pull request Dec 4, 2024
spytheman added a commit to larpon/shy that referenced this pull request Dec 4, 2024
@spytheman
Copy link
Member

I've fixed the failing compilations and pushed the changes where I could. I also made a PR to vcv88/discord.v#19 that fixes the remaining one.

@spytheman
Copy link
Member

I should have used the link to this PR on the msgpack fix too 🤔 ... then github would have linked it too automatically here.

@spytheman
Copy link
Member

spytheman commented Dec 4, 2024

The vtcc failure seems complex/time consuming to fix for me 🤔 .
I will disable that CI step for now.

edit: I've pinged @felipensp about it on Discord.

@spytheman spytheman force-pushed the check_fn_arg_promote branch from 00c6e4b to 7215d26 Compare December 4, 2024 06:46
@spytheman spytheman merged commit 17f3c8f into vlang:master Dec 4, 2024
73 checks passed
MCausc78 pushed a commit to vcv88/discord.v that referenced this pull request Dec 4, 2024
@yuyi98 yuyi98 deleted the check_fn_arg_promote branch December 4, 2024 12:01
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.

Missing compiling error on f_expecting_int( u32_number )
2 participants