You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bb5311f
Browse filesBrowse the repository at this point in the historyBrowse files
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.
Diagnostic modified (completion of an extensible variant):
Example:
type attr = ..
type attr += Str(string) | Num(int)
// let a: attr = Nu
Before (text): tests/analysis_tests/tests/src/CompletionExtensibleVariant.res
Nullable, Null
After (text): tests/analysis_tests/tests/src/CompletionExtensibleVariant.res
Num(_), Nullable, Null
Diagnostic modified (exhaustive switch snippet):
Example:
let value: attr = Str("s")
// switch valu
After (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.
Fixes: #9073
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3
Claude-Session: https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo
Signed-off-by: Christoph Knittel <ck@cca.io>
- Editor completion offers the constructors of an extensible variant declared in the current file or in the type's file, and the exhaustive switch snippet for one ends with a `_` case.
0 commit comments