mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
cgen, checker: allow using smartcasted sumtype variant values in the ORM queries (fix #23239) (#23241)
This commit is contained in:
parent
e0a63dba62
commit
f089ba9ff2
4 changed files with 39 additions and 1 deletions
26
vlib/orm/orm_sum_type_insert_test.v
Normal file
26
vlib/orm/orm_sum_type_insert_test.v
Normal file
|
@ -0,0 +1,26 @@
|
|||
import db.sqlite
|
||||
|
||||
struct SomeStruct {
|
||||
foo int
|
||||
bar string
|
||||
}
|
||||
|
||||
struct OtherStruct {
|
||||
baz f64
|
||||
}
|
||||
|
||||
type SomeSum = SomeStruct | OtherStruct
|
||||
|
||||
fn test_sum_type_insert() {
|
||||
db := sqlite.connect(':memory:')!
|
||||
sql db {
|
||||
create table SomeStruct
|
||||
}!
|
||||
|
||||
some := SomeSum(SomeStruct{})
|
||||
if some is SomeStruct {
|
||||
sql db {
|
||||
insert some into SomeStruct
|
||||
}!
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue