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

Clean up handling of Call params #5061

Merged
merged 12 commits into from
Mar 4, 2025

Conversation

geoffromer
Copy link
Contributor

@geoffromer geoffromer commented Mar 3, 2025

  • Explicitly document that *Param and *ParamPattern insts represent Call parameters.
  • Stop wrapping compile-time parameter patterns in ValueParamPattern insts (because they aren't Call parameters).
  • Document how MatchContext::results_ relates to the Call parameters, and be more consistent about when it's written to.
  • Remove RuntimeParamIndex::Unknown: we no longer need to distinguish "this Param's runtime index is unknown" from "this Param isn't a runtime param", because we no longer use Params at all in the latter case.
  • Rename RuntimeParamIndex to CallParamIndex.

As a side effect of removing the ValueParamPattern insts, this fixes a minor diagnostic bug where NoteInitializingParam didn't identify the specific parameter that led to a deduction failure, because it expects generic parameters to only be represented by SymbolicBindingPatterns, but before this change they could be wrapped in ValueParamPatterns.

@github-actions github-actions bot requested a review from chandlerc March 3, 2025 22:44
Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

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

Generally looks good, two minor comments.

// parameters" terminology in EntityWithParamsBase.
struct RuntimeParamIndex : public IndexBase<RuntimeParamIndex> {
// `Call` parameter index.
struct CallParamIndex : public IndexBase<CallParamIndex> {
static constexpr llvm::StringLiteral Label = "runtime_param";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to change this here? Or maybe useful to do in a follow-up patch to isolate the noisy churn?

(If in a follow-up, leave a TODO for this PR?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, yes, we should change this. This PR was already supposed to isolate the noisy churn of dropping all those value_param_patterns (although I admit there's been some scope creep), so it seems simpler to take care of this now.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, having seen this, I think it would be better to do this in a follow-up PR. Changing this changes essentially every test file, where-as without this there was a fairly reasonable subset of tests really impacted by the change.

I'm approving, but I'd suggest undoing this and leaving a TODO and having a PR that does just this rename so that it's a bit more isolated. Otherwise, for example, I don't think I could find the interesting diagnostic change in the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, done.

// parameters" terminology in EntityWithParamsBase.
struct RuntimeParamIndex : public IndexBase<RuntimeParamIndex> {
// `Call` parameter index.
struct CallParamIndex : public IndexBase<CallParamIndex> {
static constexpr llvm::StringLiteral Label = "runtime_param";
Copy link
Contributor

Choose a reason for hiding this comment

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

So, having seen this, I think it would be better to do this in a follow-up PR. Changing this changes essentially every test file, where-as without this there was a fairly reasonable subset of tests really impacted by the change.

I'm approving, but I'd suggest undoing this and leaving a TODO and having a PR that does just this rename so that it's a bit more isolated. Otherwise, for example, I don't think I could find the interesting diagnostic change in the output.

@geoffromer geoffromer enabled auto-merge March 4, 2025 18:18
@geoffromer geoffromer added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Mar 4, 2025
@geoffromer geoffromer enabled auto-merge March 4, 2025 19:56
@geoffromer geoffromer added this pull request to the merge queue Mar 4, 2025
Merged via the queue into carbon-language:trunk with commit d264f14 Mar 4, 2025
8 checks passed
@geoffromer geoffromer deleted the symbolic-param branch March 4, 2025 22:09
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