-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: fix missing check for invalid argument for builtin (fix #23511…
…) (#23515)
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
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,49 @@ | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:4:15: error: type `User` has no field named `typo` | ||
2 | | ||
3 | fn (u &User) debug_1() { | ||
4 | println('${u.typo}') | ||
| ~~~~ | ||
5 | } | ||
6 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:4:15: error: expression does not return a value | ||
2 | | ||
3 | fn (u &User) debug_1() { | ||
4 | println('${u.typo}') | ||
| ~~~~ | ||
5 | } | ||
6 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:8:9: error: `User` has no property `typo` | ||
6 | | ||
7 | fn debug_2[T](t T) { | ||
8 | _ := t.typo | ||
| ~~~~ | ||
9 | } | ||
10 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:8:4: error: assignment mismatch: 1 variable 0 values | ||
6 | | ||
7 | fn debug_2[T](t T) { | ||
8 | _ := t.typo | ||
| ~~ | ||
9 | } | ||
10 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:12:15: error: `User` has no property `typo` | ||
10 | | ||
11 | fn debug_3[T](t T) { | ||
12 | println('${t.typo}') | ||
| ~~~~ | ||
13 | } | ||
14 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:12:15: error: expression does not return a value | ||
10 | | ||
11 | fn debug_3[T](t T) { | ||
12 | println('${t.typo}') | ||
| ~~~~ | ||
13 | } | ||
14 | | ||
vlib/v/checker/tests/invalid_generic_field_err.vv:12:2: error: `println` can not print void expressions | ||
10 | | ||
11 | fn debug_3[T](t T) { | ||
12 | println('${t.typo}') | ||
| ~~~~~~~~~~~~~~~~~~~~ | ||
13 | } | ||
14 | |
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,20 @@ | ||
struct User {} | ||
|
||
fn (u &User) debug_1() { | ||
println('${u.typo}') | ||
} | ||
|
||
fn debug_2[T](t T) { | ||
_ := t.typo | ||
} | ||
|
||
fn debug_3[T](t T) { | ||
println('${t.typo}') | ||
} | ||
|
||
fn main() { | ||
u := &User{} | ||
u.debug_1() | ||
debug_2(u) | ||
debug_3(u) | ||
} |