-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cgen, checker: allow using smartcasted sumtype variant values in the …
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters