mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: add a known error on alias cast with generics (#13946)
This commit is contained in:
parent
1482db6d1a
commit
6412f8ba0b
33
vlib/v/tests/known_errors/testdata/cast_aliases_on_generics_type.vv
vendored
Normal file
33
vlib/v/tests/known_errors/testdata/cast_aliases_on_generics_type.vv
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
type ParseRes = Result<[]Token, ParseErr>
|
||||
|
||||
struct ParseErr{
|
||||
|
||||
}
|
||||
|
||||
type Opt<T> = None<T> | Some<T>
|
||||
|
||||
struct None<T> {}
|
||||
|
||||
struct Some<T> {
|
||||
value T
|
||||
}
|
||||
|
||||
type Result<T, U> = Err<U> | Ok<T>
|
||||
|
||||
struct Ok<T> {
|
||||
value T
|
||||
}
|
||||
|
||||
struct Err<U> {
|
||||
value U
|
||||
}
|
||||
|
||||
fn test_report() {
|
||||
r := Opt<ParseRes>(None<ParseRes>{})
|
||||
match r {
|
||||
Some<ParseRes> {
|
||||
rx := Result<[]Token, ParseErr>(r)
|
||||
}
|
||||
None<ParseRes> {}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user