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

Typechecker does not recognize typed constants #1299

Open
CryptoPascal31 opened this issue Sep 7, 2023 · 1 comment
Open

Typechecker does not recognize typed constants #1299

CryptoPascal31 opened this issue Sep 7, 2023 · 1 comment

Comments

@CryptoPascal31
Copy link
Contributor

Issue description

Typechecker does not recognize typed constants

Steps to reproduce

(module A G
  (defcap G() true)

  (defschema point
    x:integer
    y:integer
  )

  (defconst MY-POINT:object{point} {'x:5, 'y:2})

  (defun get-point-x:integer ()
    (at "x" MY-POINT))
)

(typecheck 'A)

gives

Unable to resolve type (TySchema {_tySchema = TyObject, _tySchemaType = TyVar {_tyVar = SchemaVar {_tvName = "at1_o"}}, _tySchemaPartial = FullSchema})

However if I modify slightly my code to use a function instead of a constant:

(module A G
  (defcap G() true)

  (defschema point
    x:integer
    y:integer
  )

  (defun my-point:object{point} ()
    {'x:5, 'y:2})

  (defun get-point-x:integer ()
    (at "x" (my-point)))
)

(typecheck 'A)

Everything is OK, the typechecker is happy.

Expected Behavior

Since IMHO my code is 100% valid, I would expect the type-checker to pass.

@jmcardon
Copy link
Member

Thanks for the report! We'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants