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

NimSuggest: Fix for the inlay exception hints with generic procs #23610

Open
wants to merge 18 commits into
base: devel
Choose a base branch
from

Conversation

nickysn
Copy link
Contributor

@nickysn nickysn commented May 14, 2024

Based on the fix, started by SirOlaf in #23414

SirOlaf and others added 18 commits March 16, 2024 19:34
…e shouldn't be modified, instead the code needs to be adapted to return the previous value

+ added parameter isGenericInstance to markUsed
* restored the previous calls to markUsed with isGenericInstance false
* markUsed with isGenericInstance is ignored for now, but it will be stored in the nimsuggest database later
…easons (although the parameter is currently not used)
…en inlay exception hints are turned on

* avoid all ideUse, ideDef, etc. commands in suggestSym when isGenericInstance is true
…stance = false

* for inlay exception hints, take only nimsuggest symbols with isGenericInstance = true
…to mark caught exceptions only for isGenericInstance=true records
@SirOlaf
Copy link
Contributor

SirOlaf commented May 15, 2024

Seems to work pretty well, but while looking for issues I found that iterators do not participate either (perhaps because of their transformation step?) Not a regression, previous version also didn't handle iterators from what I can tell. Also not as disruptive as the generic issue because this one at least doesn't put false positives everywhere.

proc foo() =
  raise newException(ValueError, "a")

iterator bar(): int =
  raise newException(OSError, "b")

iterator foobar[T](): T =
  raise newException(LibraryError, "c")

foo() # bell

for x in bar(): # no bell
  discard

for x in foobar[float](): # no bell
  discard

@nickysn
Copy link
Contributor Author

nickysn commented May 22, 2024

Seems to work pretty well, but while looking for issues I found that iterators do not participate either (perhaps because of their transformation step?) Not a regression, previous version also didn't handle iterators from what I can tell. Also not as disruptive as the generic issue because this one at least doesn't put false positives everywhere.

proc foo() =
  raise newException(ValueError, "a")

iterator bar(): int =
  raise newException(OSError, "b")

iterator foobar[T](): T =
  raise newException(LibraryError, "c")

foo() # bell

for x in bar(): # no bell
  discard

for x in foobar[float](): # no bell
  discard

I think it's best to report this as a separate issue, because IMO it's independent from this fix.

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

Successfully merging this pull request may close these issues.

None yet

2 participants