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

order of imports can cause errors #11187

Closed
noonien opened this issue May 6, 2019 · 0 comments

Comments

Projects
None yet
3 participants
@noonien
Copy link

commented May 6, 2019

Resolution of identifiers, in some cases, seems to erroneously depend on import order
This might cause errors depending on import order

Example

a.nim

# if the imports are reversed, it works
import c
import b

echo Foo(3)

b.nim

import c

proc Foo*(x: int): Foo = discard

c.nim:

type Foo* = array[2, byte]

Current Output

a.nim(5, 9) Error: type mismatch: got <int literal(3)> but expected 'Foo = array[0..1, byte]'

Expected Output

[0, 0]

Possible Solution

Additional Information

nightly devel version: 2019-05-02-devel-c94ab46

Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2019-05-02
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release -d:nativeStackTrace

IRC discussion about this issue starts here: https://irclogs.nim-lang.org/06-05-2019.html#10:56:15

@Araq Araq added the High Priority label May 22, 2019

Araq added a commit that referenced this issue May 23, 2019

@Araq Araq closed this in 39a3dbb May 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.