Skip to content

Self type without type ascription introduces type requirements #16407

Closed
@bertlebee

Description

@bertlebee

Compiler version

3.2.0

Minimized code

trait X { //missing requirement: self type Z[?] & X of trait X does not conform to self type Z[X.this.A] of required trait Z
  self: Z[?] => 
}

trait Z[A] extends X {
  self => // comment this to compile successfully
}

Output

compiler error:
missing requirement: self type Z[?] & X of trait X does not conform to self type Z[X.this.A]
of required trait Z

Expectation

The code should compile. Having a self type without a type ascription (i.e. just aliasing this) should not introduce any additional type requirements

Related comment from Aly https://discord.com/channels/632150470000902164/632150470000902166/1045191632049405992

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions