-
-
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.
Merge branch 'vlang:master' into fix-vinit_caller
- Loading branch information
Showing
20 changed files
with
205 additions
and
41 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
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
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) | ||
} |
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,7 @@ | ||
vlib/v/checker/tests/match_generic_case_err.vv:16:4: error: return type mismatch, it should be `int`, but it is instead `string` | ||
14 | } | ||
15 | 'int' { | ||
16 | v | ||
| ^ | ||
17 | } | ||
18 | else { |
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,22 @@ | ||
module main | ||
|
||
import strconv | ||
|
||
fn main() { | ||
println(to_int('1')) | ||
println(to_int(1)) | ||
} | ||
|
||
fn to_int[T](v T) i64 { | ||
return match typeof(v).name { | ||
'string' { | ||
strconv.atoi(v) or { 0 } | ||
} | ||
'int' { | ||
v | ||
} | ||
else { | ||
0 | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.