-
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.
- Loading branch information
Showing
7 changed files
with
75 additions
and
6 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
13 changes: 13 additions & 0 deletions
13
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.vv:9:7: notice: duplicate type: blah blah blah 11111 | ||
7 | | ||
8 | fn main() { | ||
9 | _ := Name1[int](123) | ||
| ~~~~~~~~~~~~~~~ | ||
10 | _ := Name2[int](456) | ||
11 | } | ||
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.vv:10:7: error: duplicate type: blah blah blah 22222 | ||
8 | fn main() { | ||
9 | _ := Name1[int](123) | ||
10 | _ := Name2[int](456) | ||
| ~~~~~~~~~~~~~~~ | ||
11 | } |
11 changes: 11 additions & 0 deletions
11
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@[on_duplicate: 'blah blah blah 11111'] | ||
@[notice_if_duplicate] | ||
type Name1[T] = T | int | string | ||
|
||
@[on_duplicate: 'blah blah blah 22222'] | ||
type Name2[T] = T | int | string | ||
|
||
fn main() { | ||
_ := Name1[int](123) | ||
_ := Name2[int](456) | ||
} |
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 @@ | ||
type Name[T] = T | int | string | ||
|
||
fn f(n Name[string]) { | ||
assert n as string == 'lolol' | ||
} | ||
|
||
fn g(n Name[int]) { | ||
assert n as int == 123 | ||
} | ||
|
||
fn test_main() { | ||
f(Name[string]('lolol')) | ||
g(Name[int](123)) | ||
} |