[fine] Conditionals produce alternates (yikes!)

This commit is contained in:
John Doty 2024-02-07 07:58:36 -08:00
parent 8b9a69b898
commit b43947b6f1
6 changed files with 35 additions and 44 deletions

View file

@ -127,5 +127,5 @@ fun test() -> f64 {
// like the above.
}
// @ignore WIP
/// @ignore WIP
// @no-errors

View file

@ -1,4 +0,0 @@
if true { "blarg" } else { 23 }
// @expect-errors:
// | 1:0: the type of the 'then' branch ('string') must match the type of the 'else' branch ('f64')

View file

@ -1,2 +1,4 @@
if 23 { "what" } else { "the" }
// @type-error: 0 conditions must yield a boolean
// @expect-errors:
// | 1:3: this condition produces 'f64', but must produce bool

View file

@ -1,4 +1,4 @@
if (if false { true }) { 32 } else { 23 }
// @expect-errors:
// | 1:4: the type of the 'then' branch ('bool') must match the type of the 'else' branch ('nothing')
// | 1:3: this condition produces 'nothing or bool', but must produce bool

View file

@ -3,4 +3,4 @@ fun test() {
}
// @expect-errors:
// | 2:8: the condition of the while loop must produce a boolean
// | 2:8: this condition produces 'f64', but must produce bool