From 579ac32cce0b36eae599f5423d7949e7052b901f Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 13 Apr 2022 13:45:17 +0200 Subject: [PATCH] include only checker error Signed-off-by: Vincenzo Palazzo --- ...mbination_of_alias_and_sumtype.c.must_have | 1 + .../check_combination_of_alias_and_sumtype.v | 32 +++++++++++++++++++ .../cmp_between_alias_and_sum_type_test.v | 10 ------ 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.c.must_have create mode 100644 vlib/v/gen/c/testdata/check_combination_of_alias_and_sumtype.v delete mode 100644 vlib/v/tests/cmp_between_alias_and_sum_type_test.v 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 { - } -}