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

Return function schema for atom constructors #8743

Merged
merged 5 commits into from
Jan 12, 2024

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Jan 11, 2024

Pull Request Description

close #8663

Changelog:

  • update: use MethodRootNode for the atom constructor function to preserve the call info in runtime
  • fix: return function schema for atom constructors

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label Jan 11, 2024
@4e6 4e6 self-assigned this Jan 11, 2024
Api.FunctionSchema(methodPointer, notAppliedArguments)
)
case atomConstructor: AtomConstructor =>
val functionInfo = new FunctionPointer(
Copy link
Member

Choose a reason for hiding this comment

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

Create FunctionPointer.fromConstructor(...) method and test it with #8663 (comment) test.

@4e6 4e6 added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Jan 12, 2024
@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label Jan 12, 2024
@mergify mergify bot merged commit 972b359 into develop Jan 12, 2024
29 checks passed
@mergify mergify bot deleted the wip/db/8663-provide-info-about-constructor-calls branch January 12, 2024 19:27
assertEquals("ConstructorPointer.X", c.typeName().toString());
assertEquals("Run", c.functionName());

var d = FunctionPointer.fromAtomConstructor((AtomConstructor) rawRes);
Copy link
Member

Choose a reason for hiding this comment

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

Thank you.

mergify bot pushed a commit that referenced this pull request Mar 15, 2024
The `null` check creates a new Array but always assumed a non-empty one which may lead to
```
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at org.enso.runtime/org.enso.interpreter.service.ExecutionService$FunctionPointer.collectNotAppliedArguments(ExecutionService.java:778)
at org.enso.runtime/org.enso.interpreter.instrument.job.ProgramExecutionSupport$.sendExpressionUpdate(ProgramExecutionSupport.scala:430)
at org.enso.runtime/org.enso.interpreter.instrument.job.ProgramExecutionSupport$.$anonfun$executeProgram$3(ProgramExecutionSupport.scala:81)
at org.enso.runtime/org.enso.interpreter.service.ExecutionCallbacks.callOnComputedCallback(ExecutionCallbacks.java:146)
at
org.enso.runtime/org.enso.interpreter.service.ExecutionCallbacks.updateCachedResult(ExecutionCallbacks.java:117
...
```
Added a guard to prevent the exception. The flag will be useless anyway as we won't enter the for-loop in this case.

Appears to be introduced via #8743. Discovered while debugging #9389.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide MethodCall-like information about constructor calls.
3 participants