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

add back enum ident inference, only on undeclared identifiers #23614

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented May 15, 2024

closes #23611, refs #23588

This adds back the enum identifier inference removed in #23588 but altered so that it only triggers when no symbol in scope with the same name is found. This is just to prevent further breakage while not causing bugs as the old behavior did (however #23596 still needs #23597 to work with this). Otherwise this behavior was never documented and only introduced in 1.6.14.

There are still some cases that would compile with the old behavior but not with this, such as the case where the symbol is found in scope but does not match with the enum type:

# a.nim
type Foo* = enum abc
# b.nim
import a

type
  Bar* = enum abc
  Obj* = object
    val*: Foo
# c.nim
import b

var x: Obj
x.val = abc

We could maybe make this work but it would be even more complexity for the compiler that was never promised.

@Araq
Copy link
Member

Araq commented Jun 5, 2024

Seems not to be worth it: #23611 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not preferred PR that isn't a satisfactory solution, another solution would be preferred
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression from 2.0 to devel with dirty template
2 participants