-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix #56 #57
Conversation
d.name.toString | ||
def methodNames(clazz: Clazz): List[String] = clazz.impl.body.collect { | ||
case d: DefDef => d.name.toString | ||
case d: ValDef => d.name.toString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to support override val toString
in both Scala versions. A better name for methodNames
would be welcome, although memberNames
would miss var
(which isn't a suitable implementation for toString
)
} | ||
|
||
def isCaseClass(clazz: Clazz): Boolean = clazz.mods.hasFlag(Flags.CASE) | ||
def isObject(clazz: Clazz): Boolean = clazz.mods.hasFlag(Flags.MODULE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is added to skip ()
from case objects.
@@ -34,7 +37,8 @@ object Scala3CompilerApi: | |||
case v: ValDef if v.mods.is(CaseAccessor) => v | |||
} | |||
|
|||
def className(clazz: Clazz): String = clazz.clazz.name.toString | |||
def className(clazz: Clazz): String = | |||
clazz.clazz.originalName.toString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
originalName
lets us avoid the $
in case objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
// note: also returns vals because why not | ||
def methodNames(clazz: Clazz): List[String] = | ||
clazz.t.body.collect { case d: (DefDef | ValDef) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do that in Scala 3??? pog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently :D
override val toString
get a duplicate definition #56 by including vals in our search for existingtoString
s$
and()
from the toStrings of case objects in Scala 3 (I think it wasn't an issue in Scala 2 because we never touch case objects in these versions)