Skip to content

Crash when a class extends a trait with a member signature that contains a private type member #1130

Closed
@smarter

Description

@smarter
trait A {
  private type Foo = Int

  def foo: Foo = 1
}
class B extends A

fails to compile with

dotty.tools.dotc.core.Types$MissingType: cannot resolve reference to type B(B.this).Foo
the classfile defining the type might be missing from the classpath

Full stack trace: https://gist.github.com/smarter/6a7a6d840ce0f37b1d12

Note that even if we disallow using private types in signatures, we still have to deal with traits coming from Scala 2 where this is allowed, the following fails in exactly the same way:

abstract class Foo extends scala.collection.mutable.IndexedSeqView[Nothing, Nothing]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions