Open CryptoPascal31 opened 1 year ago
Typechecker does not recognize typed constants
(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.
Since IMHO my code is 100% valid, I would expect the type-checker to pass.
Thanks for the report! We'll take a look
Issue description
Typechecker does not recognize typed constants
Steps to reproduce
gives
However if I modify slightly my code to use a function instead of a constant:
Everything is OK, the typechecker is happy.
Expected Behavior
Since IMHO my code is 100% valid, I would expect the type-checker to pass.