You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within the formal verification module, the type inference of the function result body, and hence the result property, is not properly working.
The following type error:
"Verification of test failed"
:OutputFailure: pact-issue-1107.repl:5:23: could not parse (> result 0.0): in (> result 0.0), type error: * vs decimal (CallStack (from HasCallStack): typeError, called at src-tool/Pact/Analyze/Parse/Prop.hs:452:16
Can be generated by running:
(module test GOVERNANCE
(defcap GOVERNANCE() true)
(defun get-refund (balance:decimal stakers:integer)
@model [ (property (> result 0.0)) ]
(enforce (> balance 0.0) "balance must be non-negative")
(enforce (> stakers 0) "stakers must be non-negative")
(/ balance stakers)))
(verify 'test)
The issue can be fixed by explicitly annotating the function return type (decimal).
I tried tracking town the issue, and it seems to me that in getFunChecks, we
collect function types (funTypes)
collect the set of checks for each function (moduleFunCheck)
Already here, the function type map lists the return type as TyVar:
rsoeldner
changed the title
VF type inference of function result not properly working
FV type inference of function result not properly working
Jan 6, 2023
Within the formal verification module, the type inference of the function result body, and hence the
result
property, is not properly working.The following type error:
Can be generated by running:
The issue can be fixed by explicitly annotating the function return type (
decimal
).I tried tracking town the issue, and it seems to me that in
getFunChecks
, wefunTypes
)moduleFunCheck
)Already here, the function type map lists the return type as
TyVar
:In
moduleFunCheck
here, we usemakeFunctionEnv
which binds theresult
type toSAny
(here).The text was updated successfully, but these errors were encountered: