Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki marked this pull request as ready for review September 29, 2019 17:29

def Symbol_tree(self: Symbol)(given Context): Tree = {
assert(!self.is(Case, butNot = Enum | Module))
assert(!self.is(Case) || self.isClass)
Copy link
Contributor

Choose a reason for hiding this comment

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

case object A

will translate to a term A with the flag Case:

package <empty> {
  final lazy module case <stable> <touched> val A: A$ = new A$()
  final module case <noinits> <touched> class A$ <method> <stable> <touched>()
     extends
   Object(), _root_.scala.Product, _root_.scala.Serializable { this: A.type =>}
}

The same for enums:

enum Color {
  case Red, Green, Blue
}

is transalted to

    case <stable> <static> <enum> <touched> val Red: Color =
      Color.$new(0, "Red")
    case <stable> <static> <enum> <touched> val Green: Color =
      Color.$new(1, "Green")
    case <stable> <static> <enum> <touched> val Blue: Color =
      Color.$new(2, "Blue")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no point having those assertions anyway. In the next PR Symbol_tree will return binds as well.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@liufengyun liufengyun merged commit ad83120 into scala:master Sep 30, 2019
@liufengyun liufengyun deleted the fix-#7329 branch September 30, 2019 11:27
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.

2 participants