Skip to content

Commit 58ca144

Browse files
authored
Merge pull request #1272 from GaloisInc/issue1263
Avoid concatenating Text values in `termToPat`.
2 parents 337ca6c + 1c74cf4 commit 58ca144

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

saw-core/src/Verifier/SAW/Conversion.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ resolveArgs (Matcher p m) (defaultArgsMatcher -> args@(ArgsMatcher pl _)) =
205205

206206
-- | Match a global definition.
207207
asGlobalDef :: Ident -> Matcher ()
208-
asGlobalDef ident = Matcher (Net.Atom (identText ident)) f
208+
asGlobalDef ident = Matcher (Net.Atom (identBaseName ident)) f
209209
where f (R.asGlobalDef -> Just o) | ident == o = return ()
210210
f _ = Nothing
211211

@@ -262,15 +262,15 @@ asRecordSelector m = asVar $ \t -> _1 (runMatcher m) =<< R.asRecordSelector t
262262

263263
-- | Match a constructor
264264
asCtor :: ArgsMatchable v a => Ident -> v a -> Matcher a
265-
asCtor o = resolveArgs $ Matcher (Net.Atom (identText o)) match
265+
asCtor o = resolveArgs $ Matcher (Net.Atom (identBaseName o)) match
266266
where match t = do
267267
CtorApp c params l <- R.asFTermF t
268268
guard (o == primName c)
269269
return (params ++ l)
270270

271271
-- | Match a datatype.
272272
asDataType :: ArgsMatchable v a => PrimName a -> v a -> Matcher a
273-
asDataType o = resolveArgs $ Matcher (Net.Atom (identText (primName o))) match
273+
asDataType o = resolveArgs $ Matcher (Net.Atom (identBaseName (primName o))) match
274274
where match t = do
275275
DataTypeApp dt params l <- R.asFTermF t
276276
guard (primVarIndex dt == primVarIndex o)

saw-core/src/Verifier/SAW/Term/Functor.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,15 @@ instance Net.Pattern Term where
401401
termToPat :: Term -> Net.Pat
402402
termToPat t =
403403
case unwrapTermF t of
404-
Constant ec _ -> Net.Atom (toAbsoluteName (ecName ec))
404+
Constant ec _ -> Net.Atom (toShortName (ecName ec))
405405
App t1 t2 -> Net.App (termToPat t1) (termToPat t2)
406-
FTermF (Primitive pn) -> Net.Atom (identText (primName pn))
406+
FTermF (Primitive pn) -> Net.Atom (identBaseName (primName pn))
407407
FTermF (Sort s) -> Net.Atom (Text.pack ('*' : show s))
408408
FTermF (NatLit _) -> Net.Var
409409
FTermF (DataTypeApp c ps ts) ->
410-
foldl Net.App (Net.Atom (identText (primName c))) (map termToPat (ps ++ ts))
410+
foldl Net.App (Net.Atom (identBaseName (primName c))) (map termToPat (ps ++ ts))
411411
FTermF (CtorApp c ps ts) ->
412-
foldl Net.App (Net.Atom (identText (primName c))) (map termToPat (ps ++ ts))
412+
foldl Net.App (Net.Atom (identBaseName (primName c))) (map termToPat (ps ++ ts))
413413
_ -> Net.Var
414414

415415
unwrapTermF :: Term -> TermF Term

0 commit comments

Comments
 (0)