Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve URI-based names when loading the external SAWCore format #1658

Merged
merged 3 commits into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions saw-core/src/Verifier/SAW/ExternalFormat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,15 @@ scReadExternal sc input =
lift (scResolveNameByURI sc (moduleIdentToURI ident)) >>= \case
Just vi' -> pure (EC vi' nmi t')
Nothing -> lift $ fail $ "scReadExternal: missing module identifier: " ++ show ident
_ ->
case Map.lookup vi vs of
Just vi' -> pure $ EC vi' nmi t'
Nothing ->
do vi' <- lift $ scFreshGlobalVar sc
State.put (ts, nms, Map.insert vi vi' vs)
pure $ EC vi' nmi t'
ImportedName uri _aliases ->
lift (scResolveNameByURI sc uri) >>= \case
Just vi' -> pure (EC vi' nmi t')
Nothing -> case Map.lookup vi vs of
Just vi' -> pure $ EC vi' nmi t'
Nothing ->
do vi' <- lift $ scFreshGlobalVar sc
State.put (ts, nms, Map.insert vi vi' vs)
pure $ EC vi' nmi t'

readEC :: String -> String -> ReadM (ExtCns Term)
readEC i t =
Expand Down