1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: add test for using reference of map type as struct field (PR #15828) (#15830)

This commit is contained in:
shove
2022-09-21 17:20:19 +08:00
committed by GitHub
parent 201598e68a
commit 0871eca177
4 changed files with 19 additions and 17 deletions

View File

@ -1,3 +0,0 @@
SumTypePtr{
ptr: &nil
}

View File

@ -1,14 +0,0 @@
struct S1 {}
struct S2 {}
type T1 = S1 | S2
struct SumTypePtr {
ptr &T1 = unsafe { nil }
}
fn main() {
ptr := SumTypePtr{}
println(ptr)
}

View File

@ -0,0 +1,4 @@
Ptr{
ptr1: &nil
ptr2: &nil
}

View File

@ -0,0 +1,15 @@
struct S1 {}
struct S2 {}
type T1 = S1 | S2
struct Ptr {
ptr1 &T1 = unsafe { nil }
ptr2 &map[int]int = unsafe { nil }
}
fn main() {
ptr := Ptr{}
println(ptr)
}