Missing requirement: self type does not conform to self type A
See original GitHub issueThe 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:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
That’s the example in 175499537c87c78d0b926d84b7a9030011e42c00 (in reverse line order and alphabet letter order) so I take it as expected and intentional.