Skip to content

Inconsistency between inferred and declared typing for types with restricted visibility #3870

Closed
@olafurpg

Description

@olafurpg

I was able to reproduce a Scala 2.12.4 bug with dotty 0.5.0-RC1, see original ticket scala/bug#1800

I encountered this bug today running scalafix ExplicitResultTypes on the akka codebase, here is a minimized reproduction

package a {
  private[a] object b {
    class B
  }
  object c { def getB: b.B = new b.B() }
}
package d {
  object e {
    val f = a.c.getB
    // val g: a.b.B = a.c.getB // Error

// scala 2.x
// foo.scala:10: error: object b in package a cannot be accessed in package a
//     val g: a.b.B = a.c.getB
//              ^

// dotty
// -- Error: foo.scala:10:13 ------------------------------------------------------
// 10 |    val g: a.b.B = a.c.getB // Error: does not compile
//    |           ^^^
//    |object b in package a cannot be accessed as a member of a.type from module class e$.
// one error found
  }
}

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