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

avoid enum name #610

Merged
merged 1 commit into from
Oct 5, 2023
Merged

avoid enum name #610

merged 1 commit into from
Oct 5, 2023

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Oct 4, 2023

prepare Scala 3

def makeEnum(enum: EnumerationDecl[_]) =
"case object " + buildTypeName(localName, enum, true) + " extends " + localName +
" { override def toString = " + quote(enum.value.toString) + " }"
def makeEnum(`enum`: EnumerationDecl[_]) =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I don't really care about compatibility in the generator code, we can call these enumDecl or something like that instead.

@xuwei-k xuwei-k changed the title quote enum avoid enum name Oct 5, 2023
Copy link
Owner

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eed3si9n eed3si9n merged commit 0440b7e into eed3si9n:develop Oct 5, 2023
1 check passed
@som-snytt
Copy link

psa

scala> def f(@deprecatedName("enum") y: Int) = y
def f(y: Int): Int

scala> f(enum=42)
             ^
       warning: the parameter name enum is deprecated: use y instead
val res1: Int = 42

scala> val enum = 42
           ^
       warning: Wrap `enum` in backticks to use it as an identifier, it will become a keyword in Scala 3. [quickfixable]
val enum: Int = 42

@xuwei-k xuwei-k deleted the quote-enum branch October 5, 2023 22:33
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

Successfully merging this pull request may close these issues.

3 participants