E3009

E3009#

A record pattern cannot contain only ... Use the wildcard pattern _ instead.

Erroneous example#

///|
struct Point {
  x : Int
  y : Int
}

///|
fn process_point(p : Point) -> Unit {
  match p {
    { .. } => println("Got a point")
    //^~~~~~
    // Error: Struct pattern cannot contain only `..`, use wildcard pattern `_` instead.
  }
}

Suggestion#

Use the wildcard pattern _ instead of { .. }:

///|
pub(all) struct  {
   : 
   : 
}

///|
fn ( : ) ->  {
  match  {
    _ => ("Got a point")
  }
}

///|
test {
  let  :  = { : 0, : 1 }
  ()
  ()
}

You can also use { .. } along with other fields if you want to match specific fields:

///|
fn ( : ) ->  {
  match  {
    { : 0, .. } => ("Point on y-axis")
    _ => ("Other point")
  }
}