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

Non idempotent code generated for inner methods #2738

Closed
nicolasstucki opened this issue Jun 12, 2017 · 2 comments
Closed

Non idempotent code generated for inner methods #2738

nicolasstucki opened this issue Jun 12, 2017 · 2 comments

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Jun 12, 2017

object Foo {
  def foo[X <: Int](x: X) = {
    def bar = "a"
    bar
  }

  def foo(x: String) = {
    def bar = 2
    bar
  }
}

if we use sbt 'run Foo.scala'; javap -p Foo$ I get:

public final class Foo$ {
  public static final Foo$ MODULE$;
  public static {};
  public Foo$();
  public java.lang.String foo(int);
  public int foo(java.lang.String);
  private java.lang.String bar$1();
  private int bar$2();
}

but if we do dotc Foo.scala; javap -p Foo$ I get:

public final class Foo$ {
  public static final Foo$ MODULE$;
  public static {};
  public Foo$();
  public java.lang.String foo(int);
  public int foo(java.lang.String);
  private java.lang.String bar$2();
  private int bar$1();
}

Note that the names bar$1 and bar$2 are inverted. This is not incorrect but might not be good for the incremental compilation as it can invalidates based on class files that have not really changed.

@nicolasstucki
Copy link
Contributor Author

This is breaking idempotency tests on bootstrapped compiler.

@nicolasstucki
Copy link
Contributor Author

See all blacklisted in #2756.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 15, 2017
nicolasstucki added a commit that referenced this issue Jun 18, 2017
Fix #2738: Use a LinkedHashMap for traversal determinism
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

1 participant