Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src-tool/Pact/Analyze/Translate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ data TranslateFailureNoLoc
= BranchesDifferentTypes EType EType
| NonStringLitInBinding (AST Node)
| EmptyBody
| InvalidNativeInModule Text
| MalformedArithOp Text [AST Node]
| MalformedLogicalOp Text [AST Node]
| MalformedComparison Text [AST Node]
Expand Down Expand Up @@ -116,6 +117,7 @@ describeTranslateFailureNoLoc = \case
renderFatal $ "We only support analysis of binding forms (bind / with-read) binding string literals. Instead we found " <> tShow ast
EmptyBody ->
renderFatal $ "can't translate an empty body"
InvalidNativeInModule native -> renderFatal ("Invalid native '" <> native <> "' in module code")
MalformedArithOp op args ->
renderFatal $ "Unsupported arithmetic op " <> op <> " with args " <> tShow args
MalformedLogicalOp op args ->
Expand Down Expand Up @@ -1743,10 +1745,8 @@ translateNode astNode = withAstContext astNode $ case astNode of
Some SStr _ -> shimNative' node fn [] "principal" a'
_ -> unexpectedNode astNode

AST_NFun node fn@"describe-namespace" [a] -> translateNode a >>= \case
-- assuming we have a namespace name as input, yield an empty object
Some SStr _ -> shimNative astNode node fn []
_ -> unexpectedNode astNode
AST_NFun _ fn@"describe-namespace" _ ->
throwError' (InvalidNativeInModule fn)

AST_NFun node fn as -> shimNative astNode node fn as

Expand Down
5 changes: 5 additions & 0 deletions tests/AnalyzeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ spec = describe "analyze" $ do
|]
expectPass code $ Valid (Inj Success)

describe "describe-namespace" $ do
let code = [text|(defun test () (describe-namespace 'test))|]
expectVerificationFailure code


--
-- TODO: test use of read-keyset from property once possible
--
Expand Down