Skip to content

Use of companionSymbol in the backend witnesses stale class files #402

Closed
@retronym

Description

@retronym
⚡ tail /tmp/1/* /tmp/2/*
==> /tmp/1/A.java <==
package p1;

public class A {
	public static class B {
		void foo() {}
		static void bar() {}
	}
}

==> /tmp/2/A.java <==
package p1;

public class A {
	public static class B {
		void foo() {}
	}
}

==> /tmp/2/Test.scala <==
class Test {
  new p1.A.B
}
/code/scala on 2.12.x*
⚡ javac -d /tmp /tmp/1/A.java 
/code/scala on 2.12.x*
⚡ dbg scalac-ref heads/2.12.x -classpath /tmp -d /tmp /tmp/2/A.java /tmp/2/Test.scala

In the debugger, I can see that the MethodInlineInfo includes the static method from the stale class file, as built:

    val methods = if (!classSym.isJavaDefined) classMethods else {
      val staticMethods = classSym.companionModule.info.decls.iterator.filter(m => !m.isConstructor && keepMember(m))
      staticMethods ++ classMethods
    }

The isCodefinedWith check seems insufficient for nested classes after flatten.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions