-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: add error when initializing sumtype with struct as first type (
- Loading branch information
Showing
3 changed files
with
178 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
vlib/v/checker/tests/sumtype_init_with_ref_fields_err.vv:9:10: error: reference field `Node.parent` must be initialized | ||
7 | | ||
8 | fn main() { | ||
9 | s := Sumtype{} | ||
| ~~~~~~~~~ | ||
10 | dump(s) | ||
11 | } | ||
vlib/v/checker/tests/sumtype_init_with_ref_fields_err.vv:9:10: error: reference field `Node.left` must be initialized | ||
7 | | ||
8 | fn main() { | ||
9 | s := Sumtype{} | ||
| ~~~~~~~~~ | ||
10 | dump(s) | ||
11 | } | ||
vlib/v/checker/tests/sumtype_init_with_ref_fields_err.vv:9:10: error: reference field `Node.right` must be initialized | ||
7 | | ||
8 | fn main() { | ||
9 | s := Sumtype{} | ||
| ~~~~~~~~~ | ||
10 | dump(s) | ||
11 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
struct Node { | ||
parent &Node | ||
left &Node | ||
right &Node | ||
} | ||
type Sumtype = Node | int | ||
|
||
fn main() { | ||
s := Sumtype{} | ||
dump(s) | ||
} |