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

Parantesis skip option error check #13121

Closed
duarteroso opened this issue Jan 10, 2022 · 0 comments · Fixed by #13130
Closed

Parantesis skip option error check #13121

duarteroso opened this issue Jan 10, 2022 · 0 comments · Fixed by #13130
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@duarteroso
Copy link
Contributor

duarteroso commented Jan 10, 2022

V version: 0.2.4
OS: Linux

Perhaps this issue is related to the match keyword, perhaps now 🤷🏽‍♂️
What did you do?

module main

enum Enum {
	a
	b
	c
}

fn foo() ?Enum {
	return .a
}

fn bar() bool {
	return match (foo()) {
		.a { true }
		.b, .c { false }
	}
}

fn main() {
	bar()
}

What did you expect to see?

./match_option.v:14:15: error: foo() returns an option, so it should have either an `or {}` block, or `?` at the end
   12 | 
   13 | fn bar() bool {
   14 |     return match (foo()) {
      |                  ~~~~~~~
   15 |         .a { true }
   16 |         .b, .c { false }

What did you see instead?

/tmp/v_1000/match_option.14803197502591182620.tmp.c:10963: error: invalid operand types for binary operation
/tmp/v_1000/match_option.14803197502591182620.tmp.c:10963: error: invalid aggregate type for register load
@duarteroso duarteroso added the Bug This tag is applied to issues which reports bugs. label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant