Dyno: implement removed cast copy behavior#27593
Merged
DanilaFe merged 4 commits intochapel-lang:mainfrom Aug 5, 2025
Merged
Conversation
This copy behavior relies on treating the LHS like a thing-passed-to-in-intent, which is what production effectively does by wrapping the cast in a `_removed_cast` call. Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
This should prevent cases where the lhs and the whole cast are both unknown/erroneous, in which case we shouldn't try to invoke `in` intent logic Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
1c03e30 to
19d5f92
Compare
Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
benharsh
approved these changes
Aug 5, 2025
Member
benharsh
left a comment
There was a problem hiding this comment.
Nice! This should also help quiet down some of the noise in the typed converter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes https://github.com/Cray/chapel-private/issues/7329.
This causes the following program to cause a copy initialization of
a:The error in the original issue was resolved by @benharsh as of #27486; the program in the example works under
--dyno-resolve-only. The key contribution of this PR is the invocation of the copy initializer, which production introduces via a call to_removed_cast, which has aninintent.In the spirit of dyno -- where we try to avoid odd calls to unexpected internal functions -- this PR does not replicate the call to
_removed_cast. Instead, it simply detects the auto-implemented redundant cast (added in #27486) and invokes thein-intent handling logic.Generally speaking, once call resolution is completed, there's no way for the
Resolver, or any other code, to detect how the resolution was performed. I was faced with a choice between implementing a general signaling mechanism (e.g., storing an enumeration for "how was this resolved" inCallResolutionResultor detecting the auto-cast as a special case. For now, lacking enough examples of how a general mechanism would be useful, and given how easy special-case detection is, I went with the special-casing. As a result, theVarScopeVisitor-- which performs the call to thein-intent handler -- has to do some sleuthing, detecting calls to:where no function candidate was detected.Testing
--dyno-resolve-onlyReviewed by @benharsh -- thanks!