diff --git a/fine/tests/expression/alternates.fine b/fine/tests/expression/alternates.fine index 963f1a8e..d2567276 100644 --- a/fine/tests/expression/alternates.fine +++ b/fine/tests/expression/alternates.fine @@ -14,6 +14,20 @@ fun extract_value(v: Foo or Bar) -> f64 { } // 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 // https://journal.stuffwithstuff.com/2023/08/04/representing-heterogeneous-data/ // diff --git a/fine/tests/expression/if_mismatched_arms.fine b/fine/tests/expression/if_mismatched_arms.fine new file mode 100644 index 00000000..0f9531a6 --- /dev/null +++ b/fine/tests/expression/if_mismatched_arms.fine @@ -0,0 +1,3 @@ +if true { "blarg" } else { 23 } + +// @type: 0 f64 or string