v
v copied to clipboard
checker,cgen: fix duplicates in generic sumtype
- Fix https://github.com/vlang/v/issues/19159
- Add tests
PS D:\Games\Proekti\V\vl> type test.v
@[on_duplicate: 'thats sentinel lol'; notice_if_duplicate]
type Name[T] = string | int | T
fn main() {
_ := Name[int](123)
}
PS D:\Games\Proekti\V\vl> .\v2 run test.v
test.v:5:7: notice: duplicate type: thats sentinel lol
3 |
4 | fn main() {
5 | _ := Name[int](123)
| ~~~~~~~~~~~~~~
6 | }
Note: you can control, whether to raise a error, notice or ignore if user used type, which is present as T in generic sumtype
Stale
Sorry, we'll figure something out to merge this.