Skip to content

Anonymous classes indices should not be global #2964

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

Closed
nicolasstucki opened this issue Aug 8, 2017 · 1 comment
Closed

Anonymous classes indices should not be global #2964

nicolasstucki opened this issue Aug 8, 2017 · 1 comment

Comments

@nicolasstucki
Copy link
Contributor

Currently fresh names for anonymous classes follow this pattern

class Foo {
  new Object {} // will be named Foo$$anon$1
}
class Bar {
  new Object {} // will be named Bar$$anon$2
  new Object {} // will be named Bar$$anon$3
}
class Baz {
  new Object {} // will be named Baz$$anon$4
}

which will depend on the compilation order.

We need to change it to give fresh names per owner class like:

class Foo {
  new Object {} // will be named Foo$$anon$1
}
class Bar {
  new Object {} // will be named Bar$$anon$1
  new Object {} // will be named Bar$$anon$2
}
class Baz {
  new Object {} // will be named Baz$$anon$1
}
@DarkDimius
Copy link
Contributor

I propose we do renaming late in pipeline(near the backend) but initially still create unique names fro lambdas:

  • It helps tremendously with debugging;
  • you don't know how are lambdas going to be lifted until very late.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 21, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 22, 2017
allanrenucci added a commit that referenced this issue Sep 5, 2017
Fix #2964: Refresh names for anonymous classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants