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

feat(interpreter): method calls #1652

Closed
wants to merge 1 commit into from
Closed

feat(interpreter): method calls #1652

wants to merge 1 commit into from

Conversation

jeshecdom
Copy link
Contributor

Issue

Closes #1646.

Code is ready, but I am adding tests.

Checklist

  • I have updated CHANGELOG.md
  • I have documented my contribution in docs/ and made the build locally
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

Comment on lines +944 to +949
if (selfT.kind !== "ref") {
throwNonFatalErrorConstEval(
`currently, method calls only support reference type methods`,
ast.loc,
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not support any sensible type and let the typechecker reject some programs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typechecking is actually not executed before interpretation in some parts of the compiler, like constant initialization. This causes problems. I just opened an issue #1655.

break;
case "native_function_decl":
throwNonFatalErrorConstEval(
"native function calls are currently not supported",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely will never be supported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the message to "native functions are not supported".

Copy link
Member

@novusnota novusnota Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the message to "native functions are not supported".

I'd just remove the currently: "native function calls are not supported".

Otherwise, it may seem as if we don't support them at all (outside the interpreter) :)

@jeshecdom
Copy link
Contributor Author

Requires PR #1678 to be merged into main for new tests to succeed.

@anton-trunov anton-trunov changed the title feat: interpreter can now handle AstMethodCall feat(interpreter): method calls Feb 4, 2025
@anton-trunov
Copy link
Member

Closing this for now, feel free to fix the merge conflicts and finish it after we release Tact 1.6

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

Successfully merging this pull request may close these issues.

Implement method calls in interpreter
3 participants