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

Fix call resolution search order for forwarded proc as method #26650

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

riftEmber
Copy link
Member

@riftEmber riftEmber commented Feb 4, 2025

Fix a bug where Dyno would consider forwarded method candidates even when non-forwarded function candidates were found, for a call within a method.

We only want to search for forwarding candidates if we haven't found any non-forwarding candidates. However, when resolving a call in a method, we first try resolving it as a function and then as a method with an implicit receiver. If we find function candidates, we still want to search for method candidates, but we do not want to search for forwarding method candidates even if there are no non-forwarding method candidates. This PR adds logic to skip that.

Added a test for the fixed case, where the test would previously encounter ambiguity between the non-forwarded function and forwarded method.

This bug was incidentally causing query recursion in https://github.com/Cray/chapel-private/issues/7087, where the definition of chpl__promotionType on _array relies on the correct search order.

Resolves https://github.com/Cray/chapel-private/issues/7087.

[reviewer info placeholder]

Testing:

@riftEmber riftEmber marked this pull request as draft February 4, 2025 21:34
@riftEmber riftEmber force-pushed the method-forward-recursion branch 3 times, most recently from e124e72 to 7679a53 Compare February 5, 2025 18:23
@riftEmber riftEmber changed the title Fix recursion in resolving forwarded proc as method Fix call resolution search order for forwarded proc as method Feb 5, 2025
@riftEmber riftEmber marked this pull request as ready for review February 5, 2025 18:28
@riftEmber riftEmber force-pushed the method-forward-recursion branch from 7679a53 to f2111bd Compare February 5, 2025 18:28
@riftEmber riftEmber merged commit fedc360 into chapel-lang:main Feb 5, 2025
9 checks passed
@riftEmber riftEmber deleted the method-forward-recursion branch February 5, 2025 20:23
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.

2 participants