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

MissingGenericFunctionDefinition sorted poorly in test output #4944

Open
danakj opened this issue Feb 12, 2025 · 2 comments
Open

MissingGenericFunctionDefinition sorted poorly in test output #4944

danakj opened this issue Feb 12, 2025 · 2 comments

Comments

@danakj
Copy link
Contributor

danakj commented Feb 12, 2025

Description of the bug:

The MissingGenericFunctionDefinition error ends up being attached to test output far below where it is emitted if there are other errors below. It seems to always get sorted to last for some reason?

@zygoloid suggests we may want a custom sort key for the diagnostic.

fn C[T:! type](t: T);

fn F() {
  C({});

  // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+4]]:3: error: name `a` not found [NameNotFound]
  // CHECK:STDERR:   a;
  // CHECK:STDERR:   ^
  // CHECK:STDERR:
  a;
  // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+11]]:3: error: name `b` not found [NameNotFound]
  // CHECK:STDERR:   b;
  // CHECK:STDERR:   ^
  // CHECK:STDERR:
  // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-11]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition]
  // CHECK:STDERR:   C({});
  // CHECK:STDERR:   ^
  // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-17]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere]
  // CHECK:STDERR: fn C[T:! type](t: T);
  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  // CHECK:STDERR:
  b;
}
@danakj
Copy link
Contributor Author

danakj commented Feb 12, 2025

Filing this bug because I don't intend to work on this right now - if anyone wants to pick it up just assign it.

@jonmeow
Copy link
Contributor

jonmeow commented Feb 12, 2025

This is because these issues are checked as part of CheckRequiredDefinitions. They would need to be given more specific last nodes in their diagnostic locations. As a reminder, this is a consequence of #4778.

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

No branches or pull requests

2 participants