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 symbol error reporting #1373

Merged

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jul 7, 2024

Summary

  • don't report "cannot call" error when using symbol of routines
    where the definition has an error
  • don't report "only identifier found is an error" when using let/
    var/const symbol where the initializer expression has an error
  • these errors don't provide any additional information and only
    clutter compiler and nimsuggest output

Details

  • use a common erroneous symbol handling path in semSym
  • don't turn skLet, skVar, and skConst into skErrors when the
    definition AST has an error
  • use the silent adWrappedSymError diagnostic for erroneous callees
  • remove the CalleeHasAnError diagnostic and report
  • add tests to make sure the new error reporting behaviour works
  • adjust the tpointerprocs.nim, which is affected by the different
    error reporting

If the type or init expression has an error, the symbol itself is not
turned into an error.
Instead of it, the silent `adWrappedSymError` is used.
For routine, var, let, and const symbols, no error is reported on usage
anymore.
@zerbina zerbina added compiler/sem Related to semantic-analysis system of the compiler simplification Removal of the old, unused, unnecessary or un/under-specified language features. labels Jul 7, 2024
Copy link
Collaborator

@saem saem left a comment

Choose a reason for hiding this comment

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

adWrappedSymError is so much better, really wish this approach occurred to me when I was working on this.

@saem
Copy link
Collaborator

saem commented Jul 7, 2024

/merge

Copy link

github-actions bot commented Jul 7, 2024

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

@chore-runner chore-runner bot added this pull request to the merge queue Jul 7, 2024
Merged via the queue into nim-works:devel with commit 91464de Jul 7, 2024
31 checks passed
@zerbina zerbina deleted the clean-up-erroneous-symbol-handling branch August 25, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/sem Related to semantic-analysis system of the compiler simplification Removal of the old, unused, unnecessary or un/under-specified language features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants