-
Notifications
You must be signed in to change notification settings - Fork 846
Description
Completion lists for fields of Anonymous Records include keywords in situations where the record is indirectly dereferenced.
Repro steps
Provide the steps required to reproduce the problem:
let x = [ {| Name = "foo" |} ]
x[0]. // <- invoke completions after the dot. Note you get keywords
let anon = x[0]
anon. // <- invoke completions after the dot. Note you only get members of the anonymous recordExpected behavior
Every completion list for properties of an anonymous record should only contain the members of the type.
Actual behavior
Keywords are also suggested.
Known workarounds
Directly bind the anonymous record.
Related information
Originally recorded by @isaacabraham in ionide/ionide-vscode-fsharp#1280, but repros on VS 17.6 previews today, as well as the new Ionide 7.5.0 series (which uses FCS 43.7.200).
@Krzysztof-Cieslak did some debugging and found the following:
The difference in behaviour for those 2 cases comes up from this line dotnet/fsharp@faa115a/src/Compiler/Service/FSharpCheckerResults.fs#L979
tryTcrefOfAppTy g tyin case of anon records returns ValueNone. This is obviously a correct behaviour oftryTcrefOfAppTybut I imagine some different checks should be used, or some different type of data should be passed to CompletionItem
Metadata
Metadata
Assignees
Labels
Type
Projects
Status