Fixes #17812.
Change-Id: I08202165dd3f72ae04420e7b6129b8b689e74f5c
Reviewed-on: https://go-review.googlesource.com/32870
Reviewed-by: Alan Donovan <adonovan@google.com>
 
 func ord(x Value) int {
        switch x.(type) {
+       default:
+               return -1 // force invalid value into "x position" in match
        case unknownVal:
                return 0
        case boolVal, stringVal:
                return 5
        case complexVal:
                return 6
-       default:
-               panic("unreachable")
        }
 }
 
        // ord(x) <= ord(y)
 
        switch x := x.(type) {
-       case unknownVal:
-               return x, x
-
        case boolVal, stringVal, complexVal:
                return x, y
 
                case complexVal:
                        return vtoc(x), y
                }
+
        case floatVal:
                switch y := y.(type) {
                case floatVal:
                }
        }
 
-       panic("unreachable")
+       return x, x // force unknown and invalid values into "x position" in callers of match
 }
 
 // BinaryOp returns the result of the binary expression x op y.
        case token.GEQ:
                return x >= 0
        }
-       panic("unreachable")
+       panic(fmt.Sprintf("invalid comparison %v %s 0", x, op))
 }
 
 // Compare returns the result of the comparison x op y.