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
scala>Predef.eq("")
^warning: comparing values of types typeandString using `eq` will always yieldfalsevalres1:Boolean=false
Problem
What is it trying to render as the type type?
The context was a bit tricky:
import scala.Predef._
final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
def startsWith[B >: A](that: Array[B]): Boolean = eq(that)
//def f[B >: A](that: Array[B]): Boolean = Predef.eq(that)
}
Masculine swagger made me try writing eq(that) instead of the usual this.eq(that), erroneous for xs.eq(that).
Proper style dictates that all universal (plus AnyRef) methods require an explicit receiver, because otherwise you never know.
Note that without the import (which exists for reasons of hygiene, ironically), Note that ArrayOps extends Any, not AnyRef. because the methods are not root-imported from Predef.
The text was updated successfully, but these errors were encountered:
/** Conditions where we omit the prefix when printing a symbol, to avoid
* unpleasantries like Predef.String, $read.$iw.Foo and <empty>.Bippy.
*/
final def isOmittablePrefix
Reproduction steps
Scala version: 2.13.10
Problem
What is it trying to render as the type
type
?The context was a bit tricky:
Masculine swagger made me try writing
eq(that)
instead of the usualthis.eq(that)
, erroneous forxs.eq(that)
.Proper style dictates that all universal (plus
AnyRef
) methods require an explicit receiver, because otherwise you never know.Note that without the import (which exists for reasons of hygiene, ironically),
Note that ArrayOps extends Any, not AnyRef.
because the methods are not root-imported fromPredef
.The text was updated successfully, but these errors were encountered: