-
Notifications
You must be signed in to change notification settings - Fork 247
Branches in F# inlines get added to the total #807
Comments
when I try to repeat this scenario the compiler does not create the extra branches and the C# produced looks like this
|
Presumably due to compiler changes over the last two and a bit years. I'll make a few experiments to see what the code generation is like for other types than non-nullables like structs. |
thanks - I tried net472 and netcoreapp3.1 |
Using Microsoft Visual Studio Community 2019 Version 16.8.4 (with Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd), create a new F# library project. Change the code to be
and with a nullable type, we get back to the inlined branches
|
@SteveGilham I did have a look at this but I can't find an obvious way of detecting/hiding these branches
creates a branch with no sequence points - these branches are very short though so it may need some criteria where if the branch has more than n IL instructions and no "visible" sequence points then we can hide it otherwise we keep it as it could be a branch as seen in the example. |
Please provide the following information when submitting an issue.
My Framework
My Environment
I have already...
My issue is related to (check only those which apply):
Expected Behavior
This code
should report no
<BranchPoint ...>
entriesActual Behavior
A coverage report looks like
because the
string
function is inlined, and the decompiled IL looks likeLooking at the XML we can see that we have a reported sequence point at offset 2, and then another at 80, and the branches span between offsets 20 and 67. The comment in CecilSymbolManager.cs method
BuildPointsForBranch
thatsuggests that the intent is that such branching which spans no offset matching any reported sequence point should not be included.
My first guess is that the test on line 566 should also include the test from line 400, to wit the one that goes
x.Item2.StartLine != StepOverLineCode
, so as to exclude such not-in-source sequence points. I suspect that this would clear up most of the lingering compiler-surprise branch issues in one go.Steps to reproduce the problem:
Build above code, and run
The text was updated successfully, but these errors were encountered: