Skip to content

Non-constant tuple diagnostic when impl method signature doesn't match #6162

@danakj

Description

@danakj

Description of the bug:

We should get a diagnostic about the signatures not matching, not an obscure error about tuple indexing.

https://carbon.godbolt.org/z/Wc5Eh7ecz

<source>:6:3: error: tuple index must be a constant
  fn F[self: Self]() {}
  ^~~~~~~~~~~~~~~~~~~~
<source>:2:3: note: while building thunk to match the signature of this function
  fn F[self: Self]() -> Self;
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~

It happens in here:

// If we have a self parameter, form `self.<callee_id>`.
if (function.self_param_id.has_value()) {
callee_id = PerformCompoundMemberAccess(
context, loc_id,
BuildPatternRef(context, call_arg_ids, function.self_param_id),
callee_id);
}

What did you do, or what's a simple way to reproduce the bug?

No response

What did you expect to happen?

No response

What actually happened?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions