E4029#

This expression has a type which is not a variant.

Erroneous Example#

pub(all) struct T {
  value : Int
}

pub fn check(value : Int?) -> Int {
  match value {
    T::None => 0
    Some(value) => value
  }
}

The example above tries to use T::None as a constructor pattern, but T is a struct type, not an enum or enumview type, giving the following error on line 5:

The type T is a struct type and not an enum or enumview.

Suggestions#

Make sure to use a value of the correct type instead:

pub fn check(value : Int?) -> Int {
  match value {
    None => 0
    Some(value) => value
  }
}