During using Code Lens I noticed in some cases multiple annotations which was obviously a bug. Cause of such were auto-generated methods / fields by the compiler which we're all on the same line (because they are virtual but need some kind of placement). To fix this I tried filtering each FSharpMemberOfFunctionOrValue element out which func.IsCompilerGenerated was true. However I noticed that several methods were not flagged although they are compiler generated.
Example:
type Foo() =
let foo = new Event<int>()
member __.bar1 =
foo.Publish
[<CLIEvent>]
member __.bar2 =
foo.Publish
The compiler generates here getter and setter for both members but does not flag them as compiler generated. Also the generated methods are not flagged as event neither as getter or setter method for events (e.g. IsEventAddMethodor IsEventRemoveMethod) which I think is wrong too.
Repro Steps
- Create a new F# project
- Add the F# Compiler Service package to it
- Iterate over func declarations of the example code below (use the checker)
- Print out whether methods are compiler generated
Expected behavior
Methods which are compiler generated should have the flag IsCompilerGenerated set to true.
Moreover relevant flags like IsEventAddMethod should be set to true too for events.
Here a text file which contains the output for the remove method of bar2 from the example:
EventAutogeneratedBug.txt
During using Code Lens I noticed in some cases multiple annotations which was obviously a bug. Cause of such were auto-generated methods / fields by the compiler which we're all on the same line (because they are virtual but need some kind of placement). To fix this I tried filtering each
FSharpMemberOfFunctionOrValueelement out whichfunc.IsCompilerGeneratedwas true. However I noticed that several methods were not flagged although they are compiler generated.Example:
The compiler generates here getter and setter for both members but does not flag them as compiler generated. Also the generated methods are not flagged as event neither as getter or setter method for events (e.g.
IsEventAddMethodorIsEventRemoveMethod) which I think is wrong too.Repro Steps
Expected behavior
Methods which are compiler generated should have the flag
IsCompilerGeneratedset to true.Moreover relevant flags like
IsEventAddMethodshould be set to true too for events.Here a text file which contains the output for the remove method of
bar2from the example:EventAutogeneratedBug.txt