Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker, cgen: fix match branches return type ref mismatch, when the …
- Loading branch information
Showing
7 changed files
with
171 additions
and
20 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
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 |
---|---|---|
@@ -1,7 +1,42 @@ | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:27:6: warning: cannot assign a reference to a value (this will be an error soon) left=string false right=string true ptr=true | ||
25 | | ||
26 | mut res := '' | ||
27 | res = match any { | ||
| ^ | ||
28 | string { &any } | ||
29 | else { &variable } | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:4:10: error: return type mismatch, it should be `string` | ||
2 | a := match 1 { | ||
3 | 1 { 'aa' } | ||
4 | else { 22 } | ||
| ~~ | ||
5 | } | ||
6 | println(a) | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:18:10: error: return type mismatch, it should be `&string` | ||
16 | _ = match any { | ||
17 | string { &any } | ||
18 | else { variable } | ||
| ~~~~~~~~ | ||
19 | } | ||
20 | | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:23:10: error: return type mismatch, it should be `string` | ||
21 | _ = match any { | ||
22 | string { any } | ||
23 | else { &variable } | ||
| ^ | ||
24 | } | ||
25 | | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:43:10: error: return type mismatch, it should be `&string` | ||
41 | _ = match any { | ||
42 | string { &any } | ||
43 | else { variable } | ||
| ~~~~~~~~ | ||
44 | } | ||
45 | | ||
vlib/v/checker/tests/match_return_mismatch_type_err.vv:48:10: error: return type mismatch, it should be `string` | ||
46 | _ = match any { | ||
47 | string { any } | ||
48 | else { &variable } | ||
| ^ | ||
49 | } | ||
50 | } |
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
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