Skip to content

Commit

Permalink
Fix dhall freeze to always re-freeze an import (#1471)
Browse files Browse the repository at this point in the history
Fixes #1470

`dhall freeze` no longer attempts to use the cache to fetch an import since
the cache might not match the underlying import any longer.  Instead,
`dhall freeze` now always attempts to fetch the underlying import to
compute the new hash.
  • Loading branch information
Gabriella439 authored and mergify[bot] committed Oct 24, 2019
1 parent 8f2c28a commit 90315e9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions dhall/src/Dhall/Freeze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ module Dhall.Freeze
, Intent(..)
) where

import Control.Exception (SomeException)
import Data.Monoid ((<>))
import Data.Text
import Data.Void (Void)
import Dhall.Syntax (Expr(..), Import(..), ImportHashed(..), ImportType(..))
import Dhall.Parser (Src)
import Dhall.Pretty (CharacterSet, annToAnsiStyle, layoutOpts, prettyCharacterSet)
import Dhall.Syntax (Expr(..), Import(..), ImportHashed(..), ImportType(..))
import Dhall.Util (Censor, Input(..))
import System.Console.ANSI (hSupportsANSI)

Expand Down Expand Up @@ -54,15 +52,7 @@ freezeImport directory import_ = do

let status = Dhall.Import.emptyStatus directory

let download =
State.evalStateT (Dhall.Import.loadWith (Embed import_)) status

-- Try again without the semantic integrity check if decoding fails
let handler :: SomeException -> IO (Expr Src Void)
handler _ = do
State.evalStateT (Dhall.Import.loadWith (Embed unprotectedImport)) status

expression <- Control.Exception.handle handler download
expression <- State.evalStateT (Dhall.Import.loadWith (Embed unprotectedImport)) status

case Dhall.TypeCheck.typeOf expression of
Left exception -> Control.Exception.throwIO exception
Expand Down

0 comments on commit 90315e9

Please sign in to comment.