hls-graph 2.11.0.0 → 2.12.0.0
raw patch · 2 files changed
+10/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
hls-graph.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-graph-version: 2.11.0.0+version: 2.12.0.0 synopsis: Haskell Language Server internal graph API description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server/tree/master/hls-graph#readme>
src/Development/IDE/Graph/Internal/Key.hs view
@@ -34,6 +34,7 @@ ) where --import Control.Monad.IO.Class ()+import Control.Exception (evaluate) import Data.Coerce import Data.Dynamic import qualified Data.HashMap.Strict as Map@@ -85,8 +86,15 @@ lookupKeyValue :: Key -> KeyValue lookupKeyValue (UnsafeMkKey x) = unsafePerformIO $ do+ -- NOTE:+ -- The reason for this evaluate is that the x, if not forced yet, is a thunk+ -- that forces the atomicModifyIORef' in the creation of the new key. If it+ -- isn't forced *before* reading the keyMap, the keyMap will only obtain the new+ -- key (x) *after* the IntMap is already copied out of the keyMap reference,+ -- i.e. when it is forced for the lookup in the IntMap.+ k <- evaluate x GlobalKeyValueMap _ im _ <- readIORef keyMap- pure $! im IM.! x+ pure $! im IM.! k {-# NOINLINE lookupKeyValue #-}