Complete the constructors of extensible variants
Why
Editor analysis didn't record the constructors added by type t += ..., and an open type has none in its declaration, so completion offered no constructor where a value of the type was expected. They are now registered as constructors of an open type, and typed completion of an open type offers those declared in the type's file and in the current file. Since other files can extend the type, the exhaustive switch snippet for one adds a _ case.
modifiedDiagnostic completion of an extensible variant
type attr = ..type attr += Str(string) | Num(int) // let a: attr = Nu
text
modifiedDiagnostic exhaustive switch snippet
let value: attr = Str("s")// switch valu
rescript
switch value {| Str(_) => %todo| Num(_) => %todo| Flag => %todo| _ => %todo}
Review
- Which extensions are offered? Those in the file that declares the type and in the current file; an extension in a third file is not known to the current file's analysis.