[fine] Just some more tests

This commit is contained in:
John Doty 2024-02-07 10:09:36 -08:00
parent b43947b6f1
commit 09a85596d8
2 changed files with 17 additions and 0 deletions

View file

@ -14,6 +14,20 @@ fun extract_value(v: Foo or Bar) -> f64 {
} // No error; exhaustivity analysis should work. } // No error; exhaustivity analysis should work.
} }
// Some type compatibility nonsense
fun bottom() -> string or nothing {
"woooo"
}
fun same_but_wrong_way_around_should_be_compatible() -> nothing or string {
bottom()
}
fun same_but_larger_should_be_compatible() -> nothing or f64 or string {
bottom()
}
// This is Bob Nystrom's example from // This is Bob Nystrom's example from
// https://journal.stuffwithstuff.com/2023/08/04/representing-heterogeneous-data/ // https://journal.stuffwithstuff.com/2023/08/04/representing-heterogeneous-data/
// //

View file

@ -0,0 +1,3 @@
if true { "blarg" } else { 23 }
// @type: 0 f64 or string