Skip to content

In GenBcode Emmited Classes are overwritten by companion objects. #476

@smarter

Description

@smarter
class CV {
  val x: String = "foo"
}
> run -Xprint:genBcode try/CV.scala
[info] Running dotty.tools.dotc.Main -Xprint:genBCode try/CV.scala
[info] result of try/CV.scala after genBCode:
[info] package <empty> {
[info]   class CV extends Object { 
[info]     def <init>(): CV = {
[info]       super()
[info]       this.x$$local = "foo"
[info]       ()
[info]     }
[info]     private val x$$local: String
[info]     <accessor> def x(): String = this.x$$local
[info]   }
[info]   final lazy module val CV: CV$ = new CV$()
[info]   final module class CV$ extends Object { this: CV$ => 
[info]     def <init>(): CV$ = {
[info]       super()
[info]       ()
[info]     }
[info]   }
[info] }
% javap -s -p -l -verbose CV
Classfile /home/smarter/opt/dotty/CV.class
  Last modified Apr 15, 2015; size 103 bytes
  MD5 checksum ba1dbe4cf0308e39bb80b5f6dfa44e49
  Compiled from "CV.scala"
public final class CV
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
Constant pool:
  #1 = Utf8               CV
  #2 = Class              #1              // CV
  #3 = Utf8               java/lang/Object
  #4 = Class              #3              // java/lang/Object
  #5 = Utf8               CV.scala
  #6 = Utf8               SourceFile
  #7 = Utf8               ScalaSig
{
}
SourceFile: "CV.scala"
Error: unknown attribute
  ScalaSig: length = 0x0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions