Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect type-checking of principal / callable value #4751

Open
obycode opened this issue May 4, 2024 · 0 comments
Open

Incorrect type-checking of principal / callable value #4751

obycode opened this issue May 4, 2024 · 0 comments
Labels
clarity static-analysis For issues related to the static analysis project

Comments

@obycode
Copy link
Contributor

obycode commented May 4, 2024

In this function, the type-checker should report an error:

(define-trait my-trait ())

(define-read-only (foo (x <my-trait>))
  (is-eq x .bar)
)

There is no error from the type-checker, but there will be an error at runtime:

error: Runtime Error: Runtime error while interpreting ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract-4: Unchecked(TypeError(PrincipalType, CallableType(Trait(TraitIdentifier { name: ClarityName("my-trait"), contract_identifier: QualifiedContractIdentifier { issuer: StandardPrincipalData(ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM), name: ContractName("sandbox") } }))))
@obycode obycode added clarity static-analysis For issues related to the static analysis project labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarity static-analysis For issues related to the static analysis project
Projects
Status: Status: 🆕 New
Development

No branches or pull requests

1 participant