diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-02-03 11:01:27 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-10 10:58:57 -0800 |
commit | 4b3dbd91d9d81f61809ef47a2a324eabfb122b71 (patch) | |
tree | dbbe59e7beaa04d920cf5703f982fe82a0631214 | |
parent | 90aa12ee9cca5d433459f0a825d510c8fb1c17be (diff) | |
download | scala-4b3dbd91d9d81f61809ef47a2a324eabfb122b71.tar.gz scala-4b3dbd91d9d81f61809ef47a2a324eabfb122b71.tar.bz2 scala-4b3dbd91d9d81f61809ef47a2a324eabfb122b71.zip |
SI-8219 Pending test case for unpositioned implicit error
Extracted with tweezers from ScalaTest and Scalacheck implicits.
% scalac-hash v2.11.0-M7 test/pending/pos/t8219.scala
error: type mismatch;
found : Any
required: AnyRef
Note: Any is not implicitly converted to AnyRef. You can safely
pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so.
error: type mismatch;
found : Any
required: AnyRef
Note: Any is not implicitly converted to AnyRef. You can safely
pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so.
two errors found
-rw-r--r-- | test/pending/pos/t8219.scala | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/pending/pos/t8219.scala b/test/pending/pos/t8219.scala new file mode 100644 index 0000000000..96bf03d316 --- /dev/null +++ b/test/pending/pos/t8219.scala @@ -0,0 +1,36 @@ +trait Equalizer[T] +trait Gen[A] + +class Broken { + implicit def const[T](x: T): Gen[T] = ??? + implicit def convertToEqualizer[T](left: T): Equalizer[T] = ??? + + def in(a: Any) = () + in { + import scala.None // any import will do.. + "" == "" + } + + // We fall into the errant code path above because `Any#==` and `AnyRef#==` + // are (currently) overloaded. + // + // Real classes couldn't get away with that overloading; it would result in + // a compiler error because the variants would collapse into an overriding + // relationship after erasure. + // + // + // But, a structural type can! This triggers the same error, and served as + // a backstop for this test if we change the signatures of `AnyRef#==` to + // override `Any#==`. + type T = { + def a(a: AnyRef): Boolean + def a(a: Any): Boolean + } + + def t: T = ??? + + in { + import scala.None // any import will do.. + t.a("") + } +} |