Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 406 Bytes

4024.md

File metadata and controls

24 lines (18 loc) · 406 Bytes

4024

The left-hand side of an as pattern was neither a name nor a typed name.

fun f x =
  case x of
    3 as y => y
(** ^ left-hand side of `as` pattern must be a name *)
  | _ => x

The syntax for as patterns is <name> (: <ty>)? as <pat>.

To fix

Ensure the left hand side of the as is either a name or a typed name.

fun f x =
  case x of
    y as 3 => y
  | _ => x