Skip to content

Static vars generate wrong field #2375

@odersky

Description

@odersky

If we look at the bytecode produced from run/statics.scala, we see:

Users/odersky/workspace/dotty/tests/run> javap -cp /classes -private Foo
Compiled from "statics.scala"
public class Foo {
  public static final long OFFSET$0;
  public long bitmap$0;
  public Foo$Bar$ Bar$lzy1;
  public static int mutable;
  public static int field;
  private static int mutable$$local;
  public Foo();
  private static {};
  public final Foo$Bar$ Bar();
  public static int method();
  public static void mutable_$eq(int);
  public static int accessor();
}

Note that both mutable and mutable$$local are fields. mutable should be an accessor method instead. This bug prevents us from dropping $$local suffixes in semantic names.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions