diff --git a/vlib/v/tests/match_sumtype_var_shadow_and_as.v b/vlib/v/tests/match_sumtype_var_shadow_and_as.v index 6ecd2e8b99..7ae49e2ee5 100644 --- a/vlib/v/tests/match_sumtype_var_shadow_and_as.v +++ b/vlib/v/tests/match_sumtype_var_shadow_and_as.v @@ -3,12 +3,13 @@ struct Dog{name string} type Animal = Cat | Dog -fn main() { - cat := Cat{name: 'cat'} - dog := Cat{name: 'dog'} +const ( + cat = Cat{name: 'cat'} + dog = Cat{name: 'dog'} +) + +fn test_shadow() { mut animal := Animal{} - - // test shaddow animal = cat match animal { Cat { @@ -18,7 +19,10 @@ fn main() { assert false } } - // test as +} + +fn test_as() { + mut animal := Animal{} animal = dog match animal as animal_kind { Dog { @@ -28,4 +32,4 @@ fn main() { assert false } } -} +} \ No newline at end of file