Skip to content

Conversation

bricknerb
Copy link
Contributor

@bricknerb bricknerb commented Oct 1, 2025

Before this change, we wrongly ignore the decision to generate a thunk for a function with default args by overriding this decision with the fact the return type by itself doesn't require a thunk.
This causes not generating a thunk which leads to crashing in lowering.
Add tests that show that now thunk is generated in check and it no longer crashes in lower.

Follow up of #6108.

…etScopeIdOffset()`

After this change, we correctly increment the offset by the next switch case type.
Before this change, we accidentally incremented the offset by `functions()` size instead of `cpp_overload_sets()` size and vice versa.
Also sorted the switch cases according to the order of the enum, for consistency which might help prevent a future similar incident.

This fix prevents crashing in the newly introduced test `multiple_too_few_args_calls`.

This also has the side effect of showing `null name` for `cpp_overload_set_type` and `cpp_overload_set_value`, instead of having an arbitrary name.
Examples that deomnstrate the old name is arbitrary can easily be seen in tests like `cpp_namespace.carbon` and `decayed_param.carbon`, but careful review would show that all old names are arbitrary, though often luckily almost make sense.
… a simple type

Before this change, we wrongly ignore the decision to generate a thunk for a function with default args by overriding this decision with the fact the return type by itself doesn't require a thunk.
This causes not generating a thunk which leads to crashing in lowering.
Add tests that show that now thunk is generated in `check` and it no longer crashes in `lower.

Based on carbon-language#6151.
Follow up of carbon-language#6108.
@bricknerb bricknerb marked this pull request as ready for review October 1, 2025 15:14
@github-actions github-actions bot requested a review from dwblaikie October 1, 2025 15:14
@bricknerb bricknerb requested a review from a team as a code owner October 2, 2025 14:59
@bricknerb bricknerb requested review from geoffromer and removed request for a team October 2, 2025 14:59
@bricknerb bricknerb enabled auto-merge October 2, 2025 14:59
@bricknerb bricknerb added this pull request to the merge queue Oct 2, 2025
Merged via the queue into carbon-language:trunk with commit 57c0fde Oct 2, 2025
8 checks passed
@bricknerb bricknerb deleted the thunk2 branch October 2, 2025 15:43
github-merge-queue bot pushed a commit that referenced this pull request Oct 2, 2025
…Required()` (#6150)

Also set `thunk_required` in a more consistent way, to avoid bugs like
the one fixed in #6152.

Part #6148.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants