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

ignore type symbols in lookup when enum type is expected #23694

Closed
wants to merge 1 commit into from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Jun 7, 2024

fixes #23689

When an identifier expression expects an enum type, when looking up the identifier as a symbol, type symbols are ignored, i.e.

type
  Foo = enum A, B
  C = object

let x: Foo = C

will give an "undeclared identifier" error. This is to make #23689 work in the least obtrusive way, it might cause other problems. It could also be generalized to all concrete types (expected.kind in ConcreteTypes instead of == tyEnum).

@Araq
Copy link
Member

Araq commented Jun 7, 2024

Regressions aside, this rule makes no sense to me. C is not an "undeclared" identifier, it's just that a type cannot be used as a value here.

metagn added a commit to metagn/Nim that referenced this pull request Aug 16, 2024
@Araq Araq closed this in #23976 Aug 17, 2024
@Araq Araq closed this in a354b18 Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants