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 2 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
7 changes: 7 additions & 0 deletions src-tool/Pact/Analyze/Translate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,13 @@ translateNode astNode = withAstContext astNode $ case astNode of

AST_NFun node "list" _ -> throwError' $ DeprecatedList node

-- rs (2023-05-10): Note, we handle the empty list properly (see #1182)
-- as the element type is otherwise inferred as `Any`.
AST_List node [] -> translateType node >>= \case
EType retTy -> case retTy of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it called retTy here? What is node at this point?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retTy is the return type of the translation step, i.e. SList SStr. I will change it to listTy.

The node is of type Node from the Typecheck module, see here. For the particular example above, its TyList {_tyListType = TyPrim TyString}.

SList _ -> pure $ Some retTy $ CoreTerm $ Lit []
_ -> throwError' $ TypeError node

AST_List node elems -> do
elems' <- traverse translateNode elems
Some ty litList <- mkLiteralList elems' ?? TypeError node
Expand Down
8 changes: 8 additions & 0 deletions tests/AnalyzeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4564,3 +4564,11 @@ spec = describe "analyze" $ do
(enforce false ""))
|]
"Vacuous property encountered!"

describe "regression #1182" $ do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be nice for the description to be self-contained.

expectVerified [text|
(defun test:[string] (x: [string])
@model [(property (= x x))]
(let ((default-val:[string] [])) default-val)
x)
|]