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

make log work with any types #228

Open
mimoo opened this issue Nov 10, 2024 · 0 comments · May be fixed by #231
Open

make log work with any types #228

mimoo opened this issue Nov 10, 2024 · 0 comments · May be fixed by #231
Labels

Comments

@mimoo
Copy link
Contributor

mimoo commented Nov 10, 2024

currently the log function signature is hardcoded as:

const LOG_FN: &str = "log(var: Field)";

this makes the type checker forbid the function from being used with other types than Field.

To fix that, we need to:

  1. make it so that the arguments part of a hardcoded builtin signature can be ignored by the type checker
  2. while still making sure that the type checker can verify that the returned type of a builtin function matches the expected return type expected by the caller (the builtin function does not have that information so cannot do that type checking)

In get_parsed_fns we need a flag that signals this:

        for (code, fn_handle, ignore_args) in fns {

Then FnKind::BuiltIn needs to carry that information as well.

Finally, in the typechecker, we can ignore type checks on the function arguments if we see this flag.

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

Successfully merging a pull request may close this issue.

1 participant