carymrobbins / intellij-haskforce

Haskell plugin for IntelliJ IDEA
http://carymrobbins.github.io/intellij-haskforce/
Apache License 2.0
487 stars 39 forks source link

References of a symbol are wrongly highlighted #161

Open vasily-kirichenko opened 9 years ago

vasily-kirichenko commented 9 years ago

In both the following cases the highlighting is wrong:

1. image

2. image

The code

module DateRanges where

data Date = Date Int deriving (Eq, Ord, Show)
data Ranges = Ranges [(Date, Date)] deriving Show

restrictRanges :: Date -> Date -> Ranges -> Ranges
restrictRanges loRestr hiRestr (Ranges ranges) =
    Ranges $ concatMap f ranges where
    f (lo, hi)
        | lo >= loRestr && hi <= hiRestr = [(lo, hi)]
        | hi < loRestr || lo > hiRestr = []
        | otherwise = [(max lo loRestr, min hi hiRestr)]

test :: IO ()
test = do
    let ranges = Ranges [(Date 1, Date 10)]
    print $ show $ restrictRanges (Date 3) (Date 5) ranges
carymrobbins commented 9 years ago

I'll definitely look into this. @KasperJanssens - you might also have some insight.