Skip to content

Issue #24452 - Fix emitting a confusing error for non visible class method

Fabricio Nascimento requested to merge wip/fabu/T24452-confusing-error into master

While solving for class methods on the GRE, if the method with the right parent is not visible, but more than one other class methods with the same name are, GHC would report ambiguous names, when in fact the correct error message would be that the expected class method is not visible. You can see more about it on the #24452 issue.

This fix changes the error message when trying to lookup names on GRE that must_have_parent but we get an AmbiguousOccurrence. The new behavior now points the user to the missing name, instead of the name clash which would be unhelpful in solving their compiling issue.

Please read the checklist below to make sure your contribution fulfills these expectations. Also please answer the following question in your MR description:

Where is the key part of this patch? That is, what should reviewers look at first?

Please take a few moments to address the following points:

  • if your MR may break existing programs (e.g. touches base or causes the compiler to reject programs), please describe the expected breakage and add the user-facing label. This will run ghc/head.hackage> to characterise the effect of your change on Hackage.
  • ensure that your commits are either individually buildable or squashed
  • ensure that your commit messages describe what they do (referring to tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • updates the users guide if applicable
  • mentions new features in the release notes for the next release

If you have any questions don't hesitate to open your merge request and inquire in a comment. If your patch isn't quite done yet please do add prefix your MR title with WIP:.

By default a minimal validation pipeline is run on each merge request, the full-ci label can be applied to perform additional validation checks if your MR affects a more unusual configuration.

Once your change is ready please remove the WIP: tag and wait for review. If no one has offered a review in a few days then please leave a comment mentioning @triagers and apply the Blocked on Review label.

Edited by Fabricio Nascimento

Merge request reports