trueagi-io / hyperon-experimental

MeTTa programming language implementation
https://metta-lang.dev
MIT License
151 stars 49 forks source link

Type checking for the Symbol meta-type doesn't work properly #673

Open mvpeterson opened 7 months ago

mvpeterson commented 7 months ago

Describe the bug Want to set type Symbol for a function input argument. When I pass an argument like (This is in expression) type checking is passed, though it should not.

To Reproduce Run the following MeTTa script

(: foo (-> Symbol Type))
(= (foo $x) $x)
!(foo (This is an expression))

Expected behavior [(Error (This is an expression) BadType)]

Actual behavior [(This is an expression)]

Additional context

vsbogd commented 7 months ago

Another example of the issue:

(: foo_var (-> Variable Type))
(= (foo_var $x) (get-type $x))
!(foo_var 100) ; works, fails with type error
!(foo_var $x) ; works, returns %Undefined%
!(foo_var S) ; doesn't work, returns %Undefined%
!(foo_var (an expression)) ; doesn't work, returns %Undefined%