carbon-lang icon indicating copy to clipboard operation
carbon-lang copied to clipboard

errors during template instantiation should explain that they were produced by instantiating a template

Open zygoloid opened this issue 2 years ago • 18 comments

Description of the bug:

When template instantiation fails, the error that is produced doesn't mention that instantiation was being performed, nor what the template argument values were, nor why the template was instantiated (for example, the source location at which instantiation was required). It should.

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

This can be observed by running the test explorer/testdata/template/fail_no_member.carbon, which contains this:

interface GetX {
  fn DoIt[self: Self]() -> i32;
}

impl forall [template T:! type] T as GetX {
  // Error appears on this line.
  fn DoIt[self: Self]() -> i32 { return self.x; }
}

fn Main() -> i32 {
  // It would be useful to point out this line.
  return 0.(GetX.DoIt)();
}

What did you expect to happen?

Ideally the error would instead say something like:

COMPILATION ERROR: fail_no_member.carbon:17: member access into unexpected type `i32` in `self.x`
NOTE: fail_no_member.carbon:21: in instantiation of `impl T as GetX` with `T = i32` required here

What actually happened?

The current error message is:

COMPILATION ERROR: testdata/template/fail_no_member.carbon:17: member access, unexpected i32 in self.x

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

No response

zygoloid avatar Mar 22 '23 21:03 zygoloid

Hello, I'd like to start working on this issue.

georgiy-belyanin avatar Mar 23 '23 10:03 georgiy-belyanin

Hey @Pixep sir, I would like to contribute to this issue.

beastexist avatar Mar 25 '23 14:03 beastexist

Hi and welcome @S007sayer , @thepandeyop ! Feel free to work on the issue if you wish, good first issue are generally not assigned, see https://github.com/carbon-language/carbon-lang/blob/trunk/CONTRIBUTING.md#implement-carbons-design for some explanation. For context, note that a PR was created to close the issue.

Pixep avatar Mar 26 '23 02:03 Pixep

I really feel good to work on this issue

beastexist avatar Mar 26 '23 03:03 beastexist

Thankyou for giving this opportunity to me. I really feel good to work on this issue thank you very much sir

On Sun, 26 Mar 2023, 7:45 am Adrien Leravat, @.***> wrote:

Hi and welcome @S007sayer https://github.com/S007sayer , @thepandeyop https://github.com/thepandeyop ! Feel free to work on the issue if you wish, good first issue are generally not assigned, see https://github.com/carbon-language/carbon-lang/blob/trunk/CONTRIBUTING.md#implement-carbons-design for some explanation.

— Reply to this email directly, view it on GitHub https://github.com/carbon-language/carbon-lang/issues/2705#issuecomment-1483974013, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3VZM5METJLRQK333HGN7G3W56RDVANCNFSM6AAAAAAWELQ5NM . You are receiving this because you were mentioned.Message ID: @.***>

beastexist avatar Mar 26 '23 03:03 beastexist

@thepandeyop Just to avoid surprises if you haven't seen (as I haven't explicitly mentioned it) @notfilippo has also started working on it (details visible on the issue).

Pixep avatar Mar 26 '23 04:03 Pixep

Thanks for your quick response

On Sun, 26 Mar 2023, 9:36 am Adrien Leravat, @.***> wrote:

@thepandeyop https://github.com/thepandeyop Just to avoid surprises if you haven't seen (as I haven't explicitly mentioned it) @notfilipo has also started working on it (details visible on the issue).

— Reply to this email directly, view it on GitHub https://github.com/carbon-language/carbon-lang/issues/2705#issuecomment-1483988742, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3VZM5JJPYIW2HEL3YGW653W566DBANCNFSM6AAAAAAWELQ5NM . You are receiving this because you were mentioned.Message ID: @.***>

beastexist avatar Mar 26 '23 04:03 beastexist

Thankyou

shivendra0712 avatar Mar 26 '23 11:03 shivendra0712

Hello

ghost avatar Apr 17 '23 09:04 ghost

Hey anyone still working on this issue ?!

Sage-2001 avatar Apr 22 '23 05:04 Sage-2001

#2710 has an in-progress fix, but zygoloid had a few comments that @notfilippo would still need to address. I think it's close to a merge-ready state, judging by the last round of comments.

jonmeow avatar Apr 24 '23 15:04 jonmeow

@Pixep sir please assign me this task I want to work on this error

shankkyy avatar May 23 '23 19:05 shankkyy

@shankkyy Sorry to repeat myself. You can feel free to work on this, but we don't assign issues to new contributors because some people have different time constraints. We want new contributors to feel welcome to pick the issue up when it may not be making progress. (as noted here)

jonmeow avatar May 24 '23 15:05 jonmeow

@jonmeow I totally understand and thanks to permit me to work on this issue

shankkyy avatar Oct 13 '23 07:10 shankkyy

Hello sir I would like to work on this issue

aadarshahebsingh avatar Nov 01 '23 17:11 aadarshahebsingh

To keep this issue uncluttered, I've gone through and hidden a bunch of requests to be assigned this issue, and similar off-topic comments. To reiterate what @jonmeow and @Pixep said: we do not assign issues to new contributors, but you're welcome to work on an issue even if it hasn't been assigned to you. If you're concerned that you might be duplicating someone else's work, feel free to ask on our Discord server.

geoffromer avatar Nov 01 '23 23:11 geoffromer

Hi i want to work on this issue

dhruvgupta0503 avatar Nov 28 '23 15:11 dhruvgupta0503

Removing "good first issue" here since we're talking about archiving the explorer.

jonmeow avatar Nov 28 '23 17:11 jonmeow

Closing explorer-specific issues as not-planned for now due to our decision to prioritize working on the toolchain over other implementation work in the near term: https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p3532.md

chandlerc avatar Jan 20 '24 00:01 chandlerc