@@ -464,7 +464,7 @@ printGoalSize =
464
464
resolveNames :: [String ] -> TopLevel (Set VarIndex )
465
465
resolveNames nms =
466
466
do sc <- getSharedContext
467
- Set. fromList <$> mapM (resolveName sc) nms
467
+ Set. fromList . mconcat <$> mapM (resolveName sc) nms
468
468
469
469
-- | Given a user-provided name, resolve it to some
470
470
-- 'ExtCns' that represents an unfoldable 'Constant'
@@ -477,9 +477,10 @@ resolveNames nms =
477
477
-- maps to an 'ExtCns', then instead directly look it up
478
478
-- in the SAWCore naming environment. If both stages
479
479
-- fail, then throw an exception.
480
- resolveName :: SharedContext -> String -> TopLevel VarIndex
480
+ resolveName :: SharedContext -> String -> TopLevel [ VarIndex ]
481
481
resolveName sc nm =
482
482
do cenv <- rwCryptol <$> getTopLevelRW
483
+ scnms <- fmap fst <$> io (scResolveName sc tnm)
483
484
let ? fileReader = StrictBS. readFile
484
485
res <- io $ CEnv. resolveIdentifier cenv tnm
485
486
case res of
@@ -489,14 +490,13 @@ resolveName sc nm =
489
490
ImportedName uri _ ->
490
491
do resolvedName <- io $ scResolveNameByURI sc uri
491
492
case resolvedName of
492
- Just vi -> pure vi
493
- Nothing -> fallback
494
- _ -> fallback
495
- Nothing -> fallback
493
+ Just vi -> pure $ vi : scnms
494
+ Nothing -> pure scnms
495
+ _ -> pure scnms
496
+ Nothing -> pure scnms
496
497
497
498
where
498
499
tnm = Text. pack nm
499
- fallback = fst <$> io (scResolveUnambiguous sc tnm)
500
500
501
501
502
502
normalize_term :: TypedTerm -> TopLevel TypedTerm
@@ -506,7 +506,7 @@ normalize_term_opaque :: [String] -> TypedTerm -> TopLevel TypedTerm
506
506
normalize_term_opaque opaque tt =
507
507
do sc <- getSharedContext
508
508
modmap <- io (scGetModuleMap sc)
509
- idxs <- mapM (resolveName sc) opaque
509
+ idxs <- mconcat <$> mapM (resolveName sc) opaque
510
510
let opaqueSet = Set. fromList idxs
511
511
tm' <- io (TM. normalizeSharedTerm sc modmap mempty mempty opaqueSet (ttTerm tt))
512
512
pure tt{ ttTerm = tm' }
@@ -557,11 +557,11 @@ extract_uninterp ::
557
557
TopLevel (TypedTerm , [(String ,[(TypedTerm ,TypedTerm )])])
558
558
extract_uninterp unints opaques tt =
559
559
do sc <- getSharedContext
560
- idxs <- mapM (resolveName sc) unints
560
+ idxs <- mconcat <$> mapM (resolveName sc) unints
561
561
let unintSet = Set. fromList idxs
562
562
mmap <- io (scGetModuleMap sc)
563
563
564
- opaqueSet <- Set. fromList <$> mapM (resolveName sc) opaques
564
+ opaqueSet <- Set. fromList . mconcat <$> mapM (resolveName sc) opaques
565
565
566
566
boundECRef <- io (newIORef Set. empty)
567
567
let ? recordEC = \ ec -> modifyIORef boundECRef (Set. insert ec)
@@ -1036,7 +1036,7 @@ rewritePrim ss (TypedTerm schema t) = do
1036
1036
unfold_term :: [String ] -> TypedTerm -> TopLevel TypedTerm
1037
1037
unfold_term unints (TypedTerm schema t) = do
1038
1038
sc <- getSharedContext
1039
- unints' <- mapM (resolveName sc) unints
1039
+ unints' <- mconcat <$> mapM (resolveName sc) unints
1040
1040
t' <- io $ scUnfoldConstants sc unints' t
1041
1041
return (TypedTerm schema t')
1042
1042
0 commit comments