diff --git a/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.c.must_have b/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.c.must_have new file mode 100644 index 0000000000..24f0673eeb --- /dev/null +++ b/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.c.must_have @@ -0,0 +1 @@ +// THE END. diff --git a/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.v b/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.v new file mode 100644 index 0000000000..7af5fa71d0 --- /dev/null +++ b/vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.v @@ -0,0 +1,32 @@ +type ParseRes = Result<[]Token, ParseErr> + +struct ParseErr {} + +type Opt = None | Some + +struct None {} + +struct Some { + value T +} + +type Result = Err | Ok + +struct Ok { + value T +} + +struct Err { + value U +} + +fn test_report() { + r := Opt(None{}) + match r { + Some { + // make possible cast fo the same type! + rx := Result<[]Token, ParseErr>(r.value) + } + None {} + } +} diff --git a/vlib/v/tests/cmp_between_alias_and_sum_type_test.v b/vlib/v/tests/cmp_between_alias_and_sum_type_test.v deleted file mode 100644 index f4bfee8163..0000000000 --- a/vlib/v/tests/cmp_between_alias_and_sum_type_test.v +++ /dev/null @@ -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 { - } -}