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

Unclear error message when assigning ambiguous proc to variable #6359

Closed
Wh1teDuke opened this issue Sep 10, 2017 · 2 comments · Fixed by #20932
Closed

Unclear error message when assigning ambiguous proc to variable #6359

Wh1teDuke opened this issue Sep 10, 2017 · 2 comments · Fixed by #20932

Comments

@Wh1teDuke
Copy link
Contributor

Test

proc foo(a: int) = discard
proc foo(b: int) = discard
let f = foo

Result:

Test.nim(3, 5) Error: invalid type: 'None'

My original case wasn't as obvious as this example. I would expect a message along the lines of Error: ambiguous call; both ...


>nim -v
Nim Compiler Version 0.17.2 (2017-09-10) [Windows: i386]
Copyright (c) 2006-2017 by Andreas Rumpf

git hash: 3bf8ced69e7b2b5c4c0ef57d8aa3726f2e5906fc
active boot switches: -d:release
@metagn
Copy link
Collaborator

metagn commented Jan 21, 2020

This happens for any routines with the same name, not necessarily with the same signature. A possible error message would be:

Error: identifier 'foo' matches both in.foo(a: int) [declared in /usercode/in.nim(1, 6)] and in.foo(a: string) [declared in /usercode/in.nim(2, 10)] and a type conversion must be used to declare a procvar

If one of the routines has empty arguments, it would also say Did you mean to do 'foo()'?

@jibal
Copy link

jibal commented Jul 5, 2020

I would expect a message along the lines of Error: ambiguous call; both ...

It's not a call ... you're trying to get a pointer to the proc.

metagn added a commit to metagn/Nim that referenced this issue Nov 26, 2022
Araq pushed a commit that referenced this issue Dec 1, 2022
* better procvar ambiguity errors, clean up after #20457

fixes #6359, fixes #13849

* only trigger on closedsymchoice again

* new approach

* add manual entry for ambiguous enums too

* add indent [skip ci]

* move to proc
survivorm pushed a commit to survivorm/Nim that referenced this issue Feb 28, 2023
…ang#20932)

* better procvar ambiguity errors, clean up after nim-lang#20457

fixes nim-lang#6359, fixes nim-lang#13849

* only trigger on closedsymchoice again

* new approach

* add manual entry for ambiguous enums too

* add indent [skip ci]

* move to proc
capocasa pushed a commit to capocasa/Nim that referenced this issue Mar 31, 2023
…ang#20932)

* better procvar ambiguity errors, clean up after nim-lang#20457

fixes nim-lang#6359, fixes nim-lang#13849

* only trigger on closedsymchoice again

* new approach

* add manual entry for ambiguous enums too

* add indent [skip ci]

* move to proc
bung87 pushed a commit to bung87/Nim that referenced this issue Jul 29, 2023
…ang#20932)

* better procvar ambiguity errors, clean up after nim-lang#20457

fixes nim-lang#6359, fixes nim-lang#13849

* only trigger on closedsymchoice again

* new approach

* add manual entry for ambiguous enums too

* add indent [skip ci]

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

Successfully merging a pull request may close this issue.

3 participants