Skip to content

Commit

Permalink
Merge pull request #1650 from GaloisInc/iss-1649
Browse files Browse the repository at this point in the history
  • Loading branch information
mccleeary-galois authored Apr 1, 2024
2 parents 2b0812f + fe5e9bd commit a849b97
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 41 deletions.
12 changes: 4 additions & 8 deletions src/Cryptol/ModuleSystem/Env.hs
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,23 @@ modContextOf mname me =
let localIface = lmInterface lm
localNames = lmNamingEnv lm

loadedPublicDecls = map getPublicDecls
-- XXX: do we want only public ones here?
loadedDecls = map (ifDefines . lmInterface)
$ getLoadedModules (meLoadedModules me)

params = ifParams localIface
pure ModContext
{ mctxParams = if Map.null params then NoParams
else FunctorParams params
, mctxExported = ifsPublic (ifNames localIface)
, mctxDecls = mconcat (ifDefines localIface : loadedPublicDecls)
, mctxDecls = mconcat (ifDefines localIface : loadedDecls)
, mctxNames = localNames
, mctxNameDisp = R.toNameDisp localNames
}
`mplus`
do lm <- lookupSignature mname me
let localNames = lmNamingEnv lm
-- XXX: do we want only public ones here?
loadedDecls = map (ifDefines . lmInterface)
$ getLoadedModules (meLoadedModules me)
pure ModContext
Expand All @@ -302,12 +304,6 @@ modContextOf mname me =
, mctxNames = localNames
, mctxNameDisp = R.toNameDisp localNames
}
where getPublicDecls :: LoadedModule -> IfaceDecls
getPublicDecls lm =
do let allDecls = ifDefines (lmInterface lm)
publicNames = ifsPublic (ifNames (lmInterface lm))
publicDecls = filterIfaceDecls (`Set.member` publicNames) allDecls
publicDecls



Expand Down
2 changes: 1 addition & 1 deletion src/Cryptol/TypeCheck/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ lookupVar x =
Just a -> pure (ExtVar a)
Nothing ->
do mp <- IM $ asks iVars
panic "lookupVar" $ [ "Undefined vairable"
panic "lookupVar" $ [ "Undefined variable"
, show x
, "IVARS"
] ++ map (show . debugShowUniques . pp) (Map.keys mp)
Expand Down
5 changes: 0 additions & 5 deletions tests/issues/issue1621/a.cry

This file was deleted.

3 changes: 0 additions & 3 deletions tests/issues/issue1621/b.cry

This file was deleted.

7 changes: 0 additions & 7 deletions tests/issues/issue1621/issue1621.icry

This file was deleted.

17 changes: 0 additions & 17 deletions tests/issues/issue1621/issue1621.icry.stdout

This file was deleted.

5 changes: 5 additions & 0 deletions tests/issues/issue1649/A.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// A.cry
module A where

submodule B = BFunctor where
type BTy = ()
9 changes: 9 additions & 0 deletions tests/issues/issue1649/BFunctor.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// BFunctor.cry
module BFunctor where

import interface BInterface as BI

type BTy = BI::BTy

b : BTy -> ()
b _ = ()
4 changes: 4 additions & 0 deletions tests/issues/issue1649/BInterface.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// BInterface.cry
interface module BInterface where

type BTy : *
5 changes: 5 additions & 0 deletions tests/issues/issue1649/Test.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Test.cry
module Test where

import A as A
import submodule A::B as B
2 changes: 2 additions & 0 deletions tests/issues/issue1649/issue1649.icry
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:l Test.cry
B::b ()
7 changes: 7 additions & 0 deletions tests/issues/issue1649/issue1649.icry.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Loading module Cryptol
Loading module Cryptol
Loading interface module BInterface
Loading module BFunctor
Loading module A
Loading module Test
()

0 comments on commit a849b97

Please sign in to comment.