missing-result

A value phrase has a path that does not reach `result`.

compile error, shown by synod check.

A phrase whose body contains result gives a value. Every path through it must end in a result, and all results must have one type. Here the else branch has no result.

Example

Check this program to see the diagnostic.

# package p
define Sign [v: number]
  if (v less than 0)
    result "negative"
  else
    if (v is 0)
      result "zero"

Diagnostic

p/p.synod:2:1: error[missing-result]: "Sign [v: number]" does not give a result on every path
  hint: end every path with "result …"

Fix

End every path with a `result`.

# package p
define Sign [v: number]
  if (v less than 0)
    result "negative"
  else
    if (v is 0)
      result "zero"
    else
      result "positive"