cgen, checker: allow using smartcasted sumtype variant values in the ORM queries (fix #23239) (#23241)

This commit is contained in:
Swastik Baranwal 2024-12-23 19:49:27 +05:30 committed by GitHub
parent e0a63dba62
commit f089ba9ff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 1 deletions

View 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
}!
}
}