include only checker error
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>pull/13974/head
parent
93856f82c6
commit
579ac32cce
|
|
@ -0,0 +1 @@
|
|||
// THE END.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
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> {
|
||||
// make possible cast fo the same type!
|
||||
rx := Result<[]Token, ParseErr>(r.value)
|
||||
}
|
||||
None<ParseRes> {}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
struct Empty {}
|
||||
|
||||
type IndexNumber = u32
|
||||
type NameIndexType = Empty | IndexNumber
|
||||
|
||||
fn test_casting_with_sumtype_and_alias() {
|
||||
elem := NameIndexType(Empty{})
|
||||
if elem is IndexNumber {
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue