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

Don't panic on ambig, so that we have a chance to report the error #1183

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Cryptol/ModuleSystem/NamingEnv.hs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,12 @@ collectNestedModulesDs mpath env ds =
forM_ [ tlValue nm | DModule nm <- ds ] \(NestedModule nested) ->
do let pname = thing (mName nested)
name = case lookupNS NSModule pname env of
[n] -> n
n : _ -> n -- if a name is ambiguous we may get
-- multiple answers, but we just pick one.
-- This should be OK, as the error should be
-- caught during actual renaming.
_ -> panic "collectedNestedModulesDs"
[ "Missing/ambi definition for " ++ show pname ]
[ "Missing definition for " ++ show pname ]
newEnv <- lift (runBuild (moduleDefs (Nested mpath (nameIdent name)) nested))
sets_ (Map.insert name newEnv)
let newMPath = Nested mpath (nameIdent name)
Expand Down