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

Ambiguous identifier in object constructor #11212

Closed
ghost opened this issue May 9, 2019 · 2 comments
Closed

Ambiguous identifier in object constructor #11212

ghost opened this issue May 9, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented May 9, 2019

I would expect this to be unambiguous in this context. Is this intentional/expected?

Example

# tmp_a
type
  DataKind* = enum chr
  DataDesc* = object
    kind*: DataKind

# main
import tmp_a
echo DataDesc(kind: chr)

Current Output

tmp.nim(15, 21) Error: ambiguous identifier: 'chr' -- use one of the following:
  system.chr: proc (u: range 0..255(int)): char{.noSideEffect.}
  DataKind.chr: DataKind

Expected Output

(kind: chr)

Possible Solution

Use pure enum syntax, or use a prefix like dkChr.

@mratsim
Copy link
Collaborator

mratsim commented May 9, 2019

@Araq
Copy link
Member

Araq commented May 9, 2019

Just do what the compiler tells you. Use DataKind.chr.

@Araq Araq closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants