Skip to content

type signature of subclass member resolves to the wrong path-dependent type if inheriting multiple inner traits with identical path #16724

Open
@tribbloid

Description

@tribbloid

Compiler version

3.2.1

Minimized code

  object AsDependentType {

    trait Gen {

      type Upper

      trait CoVP {
        type T <: Upper
        val vv: Upper
      }
    }

    object GenY extends Gen {

      type Upper = Product
      trait P1 extends CoVP {

        val vv: Product
      }
    }

    object GenZ extends Gen {

      type Upper = Tuple1[Int]
      trait P2 extends GenY.P1 with CoVP {

        val vv: Tuple1[Int]
      }
    }
  }

Output

[Error] /home/peng/git/dottyspike/src/main/scala/com/tribbloids/spike/dotty/Covariance.scala:46:13: error overriding value vv in trait CoVP of type Gen.this.Upper;
  value vv of type Tuple1[Int] has incompatible type
one error found

Expectation

It should compile successfully. The error information is clearly wrong, All 3 instances of Gen.this.Upper (Upper, Product, Tuple1[Int]) are super types of Tuple1[Int]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions