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

Error: redefinition of should show where previous definition is; in some cases can be super confusing #8581

Closed
timotheecour opened this issue Aug 8, 2018 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Aug 8, 2018

see example here: #8580, which I'm rewriting here:

#[
BUG:
/Users/timothee/git_clone/nim/timn/bugs/stdlib/t01_mapIt_redefinition_of_t.nim(6, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/timn/bugs/stdlib/t01_mapIt_redefinition_of_t.nim(9, 9) Error: redefinition of 't'
D20180808T142452
]#

import sequtils

when defined(case1):
  proc test() =
    # BUG
    let t = [1,2].mapIt(it)

test()

In this case it's hard to spot for users not familiar with implementation of mapIt where the previous definition was.
There are similar cases

the compiler knows where previous definition was, and should just show it

@Araq
Copy link
Member

Araq commented Aug 9, 2018

Duplicate of #447. It's somewhat hard to implement as it requires minor compiler refactorings.

@Araq Araq closed this as completed Aug 9, 2018
@timotheecour timotheecour changed the title Error: redefinition of should show where previous definition is; in some cases can be super confusing [TODO] Error: redefinition of should show where previous definition is; in some cases can be super confusing Aug 9, 2018
@timotheecour
Copy link
Member Author

redefinition error messages were improved in 539fc5d

@timotheecour timotheecour changed the title [TODO] Error: redefinition of should show where previous definition is; in some cases can be super confusing Error: redefinition of should show where previous definition is; in some cases can be super confusing Sep 22, 2018
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

No branches or pull requests

2 participants