Skip to content

tpd.ModuleDef fails if owner isn't a class #56

Closed
@DarkDimius

Description

@DarkDimius

If one tries to construct such class by hand using tpd.*

class A{
  def p() = {
    object B {val d = 1};
    B.d
  }
}

During creation of object B, Symbol.newModuleSymbol will try to get TermRef(owner.thisType, name), with will obviously lead to prefix being NoPrefix(just like it is in typeCheker generated symbols for such code) which in turn will cause this assertion to fail: https://github.com/lampepfl/dotty/blob/d827b0180b05e7461856f668c3c4ca0ea6ed5d62/src/dotty/tools/dotc/core/Types.scala#L1186

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions