Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · XO0435

Docs

XO0435: a catch-all variant built from a value a named variant has

error · reported by the checker

The catch-all keeps only values no variant names. Built from a value a named variant has, it would be a second spelling of that variant, and it compares unequal to it (equality is by variant). Write the named variant, or E.from(v), which picks it. See core 2.3 and decision 0493.

Example

enum StorageClass: Str {
  Standard = "STANDARD"
  Unknown(value: Str)
}

const S: StorageClass = StorageClass.Unknown("STANDARD")

Fix

enum StorageClass: Str {
  Standard = "STANDARD"
  Unknown(value: Str)
}

const S: StorageClass = StorageClass.Standard

Run xo explain XO0435 for this text in a terminal, or see section 10.6 of the specification.