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

parser: check fn call args without comma between them (related #22021) #22075

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Aug 19, 2024

This PR check fn call args without comma between them (related #22021).

  • Check fn call args without comma between them.
  • Add test.
fn greet(i1 int, i2 int) {
	println('${i1} ${i2}')
}

fn main() {
	greet(17 23)
}

PS D:\Test\v\tt1> v run .       
tt1.v:6:11: error: unexpected number `23`, expecting `,`
    4 | 
    5 | fn main() {
    6 |     greet(17 23)
      |              ~~
    7 | }
fn greet(i1 int, i2 int) {
	println('${i1} ${i2}')
}

fn main() {
	greet(
		17
		23
	)
}

PS D:\Test\v\tt1> v run .    
tt1.v:8:3: error: unexpected number `23`, expecting `,`
    6 |     greet(
    7 |         17
    8 |         23
      |         ~~
    9 |     )
   10 | }

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.

Excellent work.

@spytheman spytheman merged commit fbc3474 into vlang:master Aug 19, 2024
73 checks passed
@yuyi98 yuyi98 deleted the check_fn_args_comma branch August 19, 2024 14:40
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