Skip to content

New trait encoding: symbol is missing the (late)DEFERRED flag #126

Closed
@lrytz

Description

@lrytz

2.11.8:

scala> :power
scala> trait T { object O }
scala> val o = typeOf[T].member(newTermName("O"))

scala> o.debugFlagString
res0: String = <module> <stable>

scala> enteringIcode(o.debugFlagString)
res1: String = <method> <deferred> <module> <stable> <latedeferred> <latemethod>

current 2.12.x

scala> :power
scala> trait T { object O }
scala> val o = typeOf[T].member(newTermName("O"))

scala> o.debugFlagString
res0: String = <module> <stable>

scala> enteringJVM(o.debugFlagString)
res1: String = <method> <module> <stable> <latemethod>

The 2.12 bytecode looks like this

public abstract interface T {
...
  public abstract O()LT$O$;
...

Note that the lateDEFERRED flag is currently not set at all anywhere in the compiler.

When fixing this, also test the following example:

trait T {
  def f = {
    object O { val x = 1 }
    O.x
  }
}

In this case the accessor and lazy-compute methods for O are concrete (default methods) in T.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions