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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions