Skip to content

Fix #7329: Fix assertions #7339

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

Merged
merged 1 commit into from
Sep 30, 2019
Merged

Fix #7329: Fix assertions #7339

merged 1 commit into from
Sep 30, 2019

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki marked this pull request as ready for review September 29, 2019 17:29
@@ -1459,12 +1459,12 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
def Symbol_flags(self: Symbol)(given Context): Flags = self.flags

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