aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv')
-rw-r--r--v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv16
1 files changed, 16 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv b/v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv
new file mode 100644
index 0000000..64cf7fa
--- /dev/null
+++ b/v_windows/v/vlib/v/checker/tests/cannot_cast_to_struct.vv
@@ -0,0 +1,16 @@
+struct Abc {}
+struct Xyz {}
+type Alphabet = Abc | Xyz
+
+struct Test {
+ abc Alphabet
+}
+
+fn main() {
+ _ := Test(Abc{})
+ sum := Alphabet(Xyz{})
+ _ = Xyz(sum)
+ _ = Xyz(5)
+ s := Abc{}
+ _ = Xyz(&s)
+}