summaryrefslogblamecommitdiff
path: root/test/files/neg/any-vs-anyref.check
blob: 7378f0495fec14c9a88ee8820796ff73c9ba49cb (plain) (tree)





































                                                                                                  







                                                                                                  





                                                                                                  







                                                                                                  


















                                                                                                  
               
any-vs-anyref.scala:6: error: type mismatch;
 found   : a.type (with underlying type A)
 required: AnyRef
Note that A is bounded only by Equals, which means AnyRef is not a known parent.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo1[A <: Product](a: A)                                      = { type X = a.type }
                                                                                 ^
any-vs-anyref.scala:7: error: type mismatch;
 found   : a.type (with underlying type A)
 required: AnyRef
Note that A is bounded only by Product, Quux, which means AnyRef is not a known parent.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo2[A <: Product with Quux](a: A)                            = { type X = a.type }
                                                                                 ^
any-vs-anyref.scala:8: error: type mismatch;
 found   : a.type (with underlying type Product)
 required: AnyRef
Note that Product extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo3(a: Product)                                              = { type X = a.type }
                                                                                 ^
any-vs-anyref.scala:9: error: type mismatch;
 found   : Product with Quux
 required: AnyRef
Note that the parents of this type (Product, Quux) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo4(a: Product with Quux)                                    = { type X = a.type }
                                                                                 ^
any-vs-anyref.scala:10: error: value eq is not a member of Quux with Product
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo5(x: Quux with Product)                                    = (x eq "abc") && ("abc" eq x)
                                                                         ^
any-vs-anyref.scala:10: error: type mismatch;
 found   : Quux with Product
 required: AnyRef
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo5(x: Quux with Product)                                    = (x eq "abc") && ("abc" eq x)
                                                                                                ^
any-vs-anyref.scala:11: error: value eq is not a member of Quux with Product{def f: Int}
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo6(x: Quux with Product { def f: Int })                     = (x eq "abc") && ("abc" eq x)
                                                                         ^
any-vs-anyref.scala:11: error: type mismatch;
 found   : Quux with Product{def f: Int}
 required: AnyRef
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo6(x: Quux with Product { def f: Int })                     = (x eq "abc") && ("abc" eq x)
                                                                                                ^
any-vs-anyref.scala:12: error: type mismatch;
 found   : Quux with Product{def eq(other: String): Boolean}
 required: AnyRef
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x)
                                                                                                ^
any-vs-anyref.scala:22: error: value eq is not a member of Bippy
Note that Bippy extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
  def bad1(x: Bippy, y: Bippy) = x eq y
                                   ^
any-vs-anyref.scala:27: error: type mismatch;
 found   : Quux{def g(x: String): String}
 required: Quux{def g(x: Int): Int}
  f(new Quux { def g(x: String) = x })
    ^
11 errors found