Skip to content

a type defined in a trait is "not found" in an object that extends the trait (under certain circumstances) #21360

Closed
@yurique

Description

@yurique

Compiler version

3.3.3, 3.4.2, 3.5.0-RC7, 3.5.1-RC1

Preface

I'm not sure if this is a bug or works as intended. The same code compiles in Scala 2 and I don't know why it shouldn't in Scala 3 - but I might be just unaware of a particular limitation/restriction introduced in dotty.

Minimized code

(https://scastie.scala-lang.org/a2YCoAw8TOyOXi2Q7vl5Gg)

case class Table(owner: Owner.Id)

case class Owner(owner: Owner.Id) // type Id is not a member of object Playground.Owner

trait Typed[Tag] {
  type Id = String
}

object Owner extends Typed[Owner] {
  //type Id = String
}

Output

(from scastie)

type Id is not a member of object Playground.Owner

Expectation

Expectation is for this code to compile.


Observations:

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