killy971 / hpc-coveralls

coveralls.io support for haskell code coverage with hpc
http://hackage.haskell.org/package/hpc-coveralls
BSD 3-Clause "New" or "Revised" License
60 stars 20 forks source link

Fix coverage conversion rule for otherwise #20

Closed killy971 closed 9 years ago

killy971 commented 10 years ago

A custom conversion rule for the otherwise statement was added by #3.

This change introduced a problem: lines containing the otherwise statement will always be converted at least as partially covered, even if they are never run at all.

In order to fix this problem, the custom coverage conversion rule should be made aware of other coverage data for the same expression.

killy971 commented 10 years ago

An otherwise expression is represented by the 3 following BoxLabel values:

A simple way to apprach the problem would be to change CoverageEntry type to the following definition:

type CoverageEntry = (
    [MixEntry], -- mix entries
    [Integer],  -- tix values
    [String])   -- entry source code

The MixEntry list would contain all mix entries which share the same HpcPos

killy971 commented 10 years ago

From the current implementation, one way to proceed would be to create a function signature:

[(MixEntry, Integer, [String])] -> [([MixEntry], [Integer], [String])]

to aggregate the current mixEntryTixs values based on the HpcPos value.

killy971 commented 9 years ago

Fixed by 17c6f99d1edf6832c03a382b2bfeb78023b48956