Decorate generated code from inline functions with an 'FSharpInlineFunction' attribute
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
When an inline function is written in F# and compiled, most uses of this function are conceptually replaced by the body of the function during compilation, however in the generated assembly, a non-inline version of this function remains, so that it can be accessed via reflection and used as a function parameter, etc. (I assume).
I would like this code to be decorated with a new attribute, `FSharpInlineFunction` or similar. The primary purpose of this would be to allow me to remove the uses of this function from reports produced by code coverage tools such as dotcover. There is no way that I know of that it is logically possible for a code coverage tool to detect all calls correctly to an inline function all the time, as by definition, if inlined, no information remains after compilation at the point this code was called. Hence, in my experience, tools return that inline functions are untested, whether they are or are not...
As a comparison, I already have to do something similar to remove 'untested functions' listed in reports by such tools for the properties generated when an F# record is compiled, the standard implementation of `Object.ToString()` for F# types such as records and DUs, etc. These are nicely decorated by `CompilerGenerated` attribute and so are easy to remove; an F# programmer should be able to assume such code is correct by definition, so it doesn't add anything useful to the information in the report.
Contributor guide
Assessment
This issue has not been assessed yet.