Skip to content

Commit

Permalink
Add types for newtype constructors. Fixes #1870
Browse files Browse the repository at this point in the history
  • Loading branch information
yav committed May 16, 2023
1 parent df95bf4 commit cbd03df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cryptol-saw-core/src/Verifier/SAW/CryptolEnv.hs
Expand Up @@ -297,9 +297,12 @@ mkCryEnv env =
(types, _) <-
liftModuleM modEnv $
do prims <- MB.getPrimMap
-- noIfaceParams because we don't support translating functors yet
TM.inpVars `fmap` MB.genInferInput P.emptyRange prims
MI.noIfaceParams ifaceDecls
infInp <- MB.genInferInput P.emptyRange prims MI.noIfaceParams ifaceDecls
let newtypeCons = Map.fromList
[ (T.ntName nt, T.newtypeConType nt)
| nt <- Map.elems (TM.inpNewtypes infInp)
]
pure (newtypeCons `Map.union` TM.inpVars infInp)
let types' = Map.union (eExtraTypes env) types
let terms = eTermEnv env
let cryEnv = C.emptyEnv
Expand Down
4 changes: 4 additions & 0 deletions intTests/test_1870/A.cry
@@ -0,0 +1,4 @@
module A where

newtype A = { x : [8] }

5 changes: 5 additions & 0 deletions intTests/test_1870/test.saw
@@ -0,0 +1,5 @@
import "A.cry";

// Make sure that `newtypes` work.
// Specifically, that `A` is in scope.
print {{ A { x = 2 } }};

0 comments on commit cbd03df

Please sign in to comment.