-
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.
parser,checker,ast: support
@[must_use]
tag for fns/methods, and an…
… experimental `-check-result` option (vlang#22983)
- Loading branch information
Showing
8 changed files
with
108 additions
and
4 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
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,14 @@ | ||
vlib/v/checker/tests/must_use.vv:22:2: warning: return value must be used, function `f` was tagged with `@[must_use]` | ||
20 | | ||
21 | fn main() { | ||
22 | f() | ||
| ~~~ | ||
23 | g() | ||
24 | h() | ||
vlib/v/checker/tests/must_use.vv:29:4: warning: return value must be used, method `m` was tagged with `@[must_use]` | ||
27 | println(h()) | ||
28 | a := Abc(5) | ||
29 | a.m() | ||
| ~~~ | ||
30 | println(a.m()) | ||
31 | } |
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,31 @@ | ||
type Abc = int | ||
|
||
@[must_use] | ||
fn (a Abc) m() int { | ||
return 7 | ||
} | ||
|
||
@[must_use] | ||
fn f() int { | ||
return 42 | ||
} | ||
|
||
fn g() int { | ||
return 123 | ||
} | ||
|
||
fn h() (int, int) { | ||
return 123, 456 | ||
} | ||
|
||
fn main() { | ||
f() | ||
g() | ||
h() | ||
println(f()) | ||
println(g()) | ||
println(h()) | ||
a := Abc(5) | ||
a.m() | ||
println(a.m()) | ||
} |
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