From 11fc34c7d08bed7841f3ac4f1d7ea260dbd9882c Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 10 Apr 2022 23:00:24 +0200 Subject: [PATCH] checker: ensure that the variant SubType exists Signed-off-by: Vincenzo Palazzo --- .../tests/undefined_type_on_sumtype.vv | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 vlib/v/checker/tests/undefined_type_on_sumtype.vv diff --git a/vlib/v/checker/tests/undefined_type_on_sumtype.vv b/vlib/v/checker/tests/undefined_type_on_sumtype.vv new file mode 100644 index 0000000000..51b836d89f --- /dev/null +++ b/vlib/v/checker/tests/undefined_type_on_sumtype.vv @@ -0,0 +1,34 @@ +type ParseRes = Result<[]Token, ParseErr> + +// Token type is unknown +//struct Token {} + +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 { + rx := r.value + } + None {} + } +}