-
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.
all: check error of generic symbol and cleanup generic symbol
- Loading branch information
Showing
18 changed files
with
141 additions
and
123 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
vlib/v/parser/tests/duplicated_generic_err.vv:1:12: error: duplicated generic parameter `A` | ||
1 | fn test<A, A>() {} | ||
1 | fn test[A, A]() {} | ||
| ^ |
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 +1 @@ | ||
fn test<A, A>() {} | ||
fn test[A, A]() {} |
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,3 +1,3 @@ | ||
vlib/v/parser/tests/generic_lowercase_err.vv:1:22: error: generic parameter needs to be uppercase | ||
1 | fn lowercase_generic<a>() {} | ||
1 | fn lowercase_generic[a]() {} | ||
| ^ |
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 +1 @@ | ||
fn lowercase_generic<a>() {} | ||
fn lowercase_generic[a]() {} |
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,5 +1,5 @@ | ||
vlib/v/parser/tests/generic_struct_type_decl_err.vv:1:13: error: generic parameter name needs to be exactly one char | ||
1 | struct GMap<Hashable<K>, V> { | ||
1 | struct GMap[Hashable[K], V] { | ||
| ~~~~~~~~ | ||
2 | map_ map[int]V | ||
3 | } |
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,17 +1,17 @@ | ||
struct GMap<Hashable<K>, V> { | ||
struct GMap[Hashable[K], V] { | ||
map_ map[int]V | ||
} | ||
|
||
fn (t GMap<Hashable<K>, V>) contains(k K) bool { | ||
fn (t GMap[Hashable[K], V]) contains(k K) bool { | ||
return true // TODO | ||
} | ||
|
||
fn (t GMap<Hashable<K>, V>) set(k K, v V) { | ||
fn (t GMap[Hashable[K], V]) set(k K, v V) { | ||
// TODO | ||
} | ||
|
||
fn main() { | ||
x := GMap<string, string>{} | ||
x := GMap[string, string]{} | ||
x.set("hello", "world") | ||
println(x.contains("hello")) | ||
} |
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,5 @@ | ||
vlib/v/parser/tests/generic_symbol_err.vv:1:13: error: The generic symbol `<>` is obsolete, please replace it with `[]` | ||
1 | pub fn what1<A>(params ...A) { | ||
| ^ | ||
2 | println(params) | ||
3 | } |
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,5 @@ | ||
pub fn what1<A>(params ...A) { | ||
println(params) | ||
} | ||
|
||
fn main() {} |
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,3 +1,3 @@ | ||
vlib/v/parser/tests/long_generic_err.vv:1:17: error: generic parameter name needs to be exactly one char | ||
1 | fn long_generic<Abc>() {} | ||
1 | fn long_generic[Abc]() {} | ||
| ~~~ |
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 +1 @@ | ||
fn long_generic<Abc>() {} | ||
fn long_generic[Abc]() {} |
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,3 +1,3 @@ | ||
vlib/v/parser/tests/too_many_generics_err.vv:1:40: error: cannot have more than 9 generic parameters | ||
1 | fn too_many<A, B, D, E, F, G, H, I, J, K>() {} | ||
1 | fn too_many[A, B, D, E, F, G, H, I, J, K]() {} | ||
| ^ |
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 +1 @@ | ||
fn too_many<A, B, D, E, F, G, H, I, J, K>() {} | ||
fn too_many[A, B, D, E, F, G, H, I, J, K]() {} |
13 changes: 6 additions & 7 deletions
13
vlib/v/parser/tests/too_many_layers_embedded_generic_type_err.out
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,6 @@ | ||
vlib/v/parser/tests/too_many_layers_embedded_generic_type_err.vv:11:9: error: too many levels of Parser.parse_generic_inst_type() calls: 11, probably due to too many layers embedded generic type | ||
9 | o, Wprld< | ||
10 | o, Wprld< | ||
11 | o, Wprld< | ||
| ^ | ||
12 | o, Wprld< | ||
13 | o, Wprld< | ||
vlib/v/parser/tests/too_many_layers_embedded_generic_type_err.vv:2:2: error: unexpected token `,`, expecting `]` | ||
1 | Hello, Wprld[ | ||
2 | o, Wprld[ | ||
| ^ | ||
3 | o, Wprld[ | ||
4 | o, Wprld[ |
190 changes: 95 additions & 95 deletions
190
vlib/v/parser/tests/too_many_layers_embedded_generic_type_err.vv
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,95 +1,95 @@ | ||
Hello, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
o, Wprld< | ||
Hello, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ | ||
o, Wprld[ |