You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- [E057] TypeMismatchError:-------------------------------------------------1|defbar[T]:Unit= foo[T&Any]
|^|Type argument T&Any does not conform to lower bound Any|-----------------------------------------------------------------------------|Explanation (enabled by `-explain`)
|---------------------------------------|I tried to show that
|T&Any| conforms to
|Any| but the comparison trace ended with`false`:||==>T&Any<:Any|<==T&Any<:Any=true||The tests were made under the empty constraint
-----------------------------------------------------------------------------1 error found
-- [E057] TypeMismatchError:-------------------------------------------------1|foo[String]
|^|Type argument String does not conform to lower bound CharSequence|-----------------------------------------------------------------------------|Explanation (enabled by `-explain`)
|---------------------------------------|I tried to show that
|String| conforms to
|CharSequence| but the comparison trace ended with`false`:||==>String<:CharSequence|==>String<:CharSequence|==>CharSequence<:CharSequence (left is approximated)
|==> (java.lang : java.lang.type) <: java.lang.type|<== (java.lang : java.lang.type) <: java.lang.type=true|<==CharSequence<:CharSequence (left is approximated) =true|<==String<:CharSequence=true|<==String<:CharSequence=true||The tests were made under the empty constraint
-----------------------------------------------------------------------------1 error found
Expectation
An explanation that shows Any <: T & Any = false.
An explanation that shows CharSequence <: String = false.
The text was updated successfully, but these errors were encountered:
Oh, this is true of type arguments for traits too:
scala>traitBar[A, B>:A]
// defined trait Bar
scala>typeQux=Bar[CharSequence, String]
-- [E057] TypeMismatchError:-------------------------------------------------1|typeQux=Bar[CharSequence, String]
|^|Type argument String does not conform to lower bound CharSequence|-----------------------------------------------------------------------------|Explanation (enabled by `-explain`)
|---------------------------------------|I tried to show that
|String| conforms to
|CharSequence| but the comparison trace ended with`false`:||==>String<:CharSequence|==>String<:CharSequence|==>CharSequence<:CharSequence (left is approximated)
|==> (java.lang : java.lang.type) <: java.lang.type|<== (java.lang : java.lang.type) <: java.lang.type=true|<==CharSequence<:CharSequence (left is approximated) =true|<==String<:CharSequence=true|<==String<:CharSequence=true||The tests were made under the empty constraint
-----------------------------------------------------------------------------1 error found
which makes me think that this could be the root cause of #15568, as that's a very similar issue?
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 4, 2022
Compiler version
3.1.3, 3.2.0-RC1
Minimized code
Output
Expectation
Any <: T & Any = false
.CharSequence <: String = false
.The text was updated successfully, but these errors were encountered: