Skip to content

match throws invalid 'index out of bounds' exception #170

Description

@nickcollins
# match 3 with | 0 -> "z" | 1 -> "o" | 6 -> "t" | _ -> "m";;
- : string = "m"
# match 3 with | 0 -> "z" | 1 -> "o" | 2 -> "t" | _ -> "m";;
Exception: Invalid_argument "index out of bounds".
# let thing = function | 0 -> "z" | 2 -> "t" | 4 -> "f" | _ -> "meh";;
val thing : int -> string = <fun>
# thing -1;;
File "", line 1, characters 0-4:
Error: This expression has type int -> string
       but an expression was expected of type int

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions