question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing requirement: self type does not conform to self type A

See original GitHub issue

The following code snippet compiles with scalac but not with dotc

package squants
trait Quantity[A <: Quantity[A]] { self: A => }
trait TimeDerivative[A <: Quantity[A]] { self: Quantity[_] => }

Dotty reports the error message

-- Error: tests/pos/missing-requirement/Quantity.scala -------------------------
3 |trait TimeDerivative[A <: Quantity[A]] { self: Quantity[_] => }
  |      ^
  |missing requirement: self type squants.Quantity[_] & squants.TimeDerivative[A] of trait TimeDerivative does not conform to self type A' of required trait Quantity
  |
  |where:    A  is a type in trait TimeDerivative with bounds <: squants.Quantity[LazyRef(A)]
  |          A' is a type in trait Quantity with bounds <: squants.Quantity[LazyRef(A)]

Removing the self: Quantity[_] annotation on TimeDerivative removes the error, and makes the rest of the squants project compile with Dotty 🎉

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
oderskycommented, Apr 10, 2017

@olafurpg Let’s worry about this if we see several errors of this type. For know I am hoping this is quite a rare case.

0reactions
dwijnandcommented, Jul 21, 2021

That’s the example in 175499537c87c78d0b926d84b7a9030011e42c00 (in reverse line order and alphabet letter order) so I take it as expected and intentional.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala: illegal inheritance; self-type Y does not conform to X's ...
I am just saying that a type extending HandleOwner will be also a SELF, and the compiler should just accept it, and take...
Read more >
HIGHLIGHTING: Illegal inheritance, self type does not conform....
HIGHLIGHTING: Illegal inheritance, self type does not conform.... Is duplicated by 1. Is duplicated by 1 issue (0 unresolved). N. SCL-4027 Self type...
Read more >
Protocol conformance stopped working in Xcode 13
Basically, the code worked fine with Xcode 12.5, but in Xcode 13 the structs and classes no longer conform to the protocols for...
Read more >
Azure AD authentication & authorization error codes
Learn about the AADSTS error codes that are returned from the Azure AD security token service (STS).
Read more >
Self-Select PIN Method for Forms 1040 and 4868 Modernized ...
Form 8283, Non-Cash Charitable Contributions, Section A (if any statement or qualified appraisal is required) or Section B, Donated Property, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found