Fix crash on generic call to local function (#6671)#6679
Fix crash on generic call to local function (#6671)#6679zygoloid merged 4 commits intocarbon-language:trunkfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
You'll need to sign the CLA before we can do much here |
|
hi @danakj , |
|
Thanks, I re-ran the check. It seems that tests are failing. Have you tried running the test suites locally? |
zygoloid
left a comment
There was a problem hiding this comment.
Thanks! Just a request for a TODO comment then I think this is good to go.
| } | ||
| if (!name_scope_id.has_value()) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
I think we'll need to include something here to avoid mangling collisions. For example:
fn F(T:! Core.Copy, y: T, b: bool) -> T {
if (b) {
fn G(x: T) -> T { return x; }
return G(y);
} else {
fn G(x: T) -> T { return x; }
return G(y);
}
}
fn Run() -> i32 {
return F(i32, 0, true);
}Here we need to give the two different G functions different mangled names. But I don't think we have a good way to handle this right now. We probably can't do much better in general than some kind of sequential numbering scheme.
Can you add a TODO: comment here so we don't forget?
Summary
MangleInverseQualifiedNameScopeby skipping missing name scopes (local functions have no parent scope).