fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Fix analysis of conjunctive patterns for exhaustiveness

Open dsyme opened this issue 3 years ago • 7 comments

The analysis of conjunctive patterns pat & pat has problems.

  • https://github.com/dotnet/fsharp/issues/1281
  • https://github.com/dotnet/fsharp/issues/3294

This is a first look at fixing this - it will need some care and careful review but let's first see if this causes any problems.

dsyme avatar Apr 20 '22 06:04 dsyme

Improving the pattern matching in conjunction with AP would be really nice . I have hit some of above limitation, making hard to grasp for a newcomer

edgarfgp avatar Jul 22 '22 19:07 edgarfgp

This probably needs a bunch of tests, from the linked issues.

vzarytovskii avatar Aug 24 '22 13:08 vzarytovskii

/azp run

vzarytovskii avatar Sep 05 '22 16:09 vzarytovskii

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Sep 05 '22 16:09 azure-pipelines[bot]

This probably needs a bunch of tests, from the linked issues.

I did add some unites locally and it seems that only the second issue on the list is fixed. The first one still show a warning "This rule will never be matched"

Happy to raise a PR to Don's fork with the unit tests :)

edgarfgp avatar Sep 19 '22 12:09 edgarfgp

@edgarfgp Thank you so much for checking! I've checked too and it seems both are fixed - with the first issue, two warnings were being generated - one for incomplete matching, and one for "never matched". The second is correct to emit, the first is not.

I've added testing for both test cases.

dsyme avatar Sep 22 '22 14:09 dsyme

@vzarytovskii This is ready

dsyme avatar Sep 22 '22 14:09 dsyme

@dsyme Thanks for fixing this . I use AP and this will make the experience much better

edgarfgp avatar Sep 23 '22 12:09 edgarfgp

@vzarytovskii This seems to be ready and the CI timed out. Would be awesome to have this in :)

edgarfgp avatar Sep 27 '22 10:09 edgarfgp