diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-02 06:41:31 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-02 14:37:36 -0800 |
commit | 451e1dc2da16c1bb5a7a59488865df9294eeaf3e (patch) | |
tree | dcbae11619389a16115d005ab2fc9bfdf5c4ba8d /test/files/neg/logImplicits.scala | |
parent | beb875187914b12b1b9dbb5621447067e2926c7c (diff) | |
download | scala-451e1dc2da16c1bb5a7a59488865df9294eeaf3e.tar.gz scala-451e1dc2da16c1bb5a7a59488865df9294eeaf3e.tar.bz2 scala-451e1dc2da16c1bb5a7a59488865df9294eeaf3e.zip |
Added -Xlog-implicit-conversions.
New command line option prints a message whenever the compiler
inserts an implicit conversion. Implicit parameters are not
under consideration here, since the primary motivation is to make
it easy to inspect your code for unintentional conversions, since
they can have dramatic performance implications.
class A {
def f(xs: Array[Byte]) = xs.size
def g(xs: Array[Byte]) = xs.length
}
% scalac -Xlog-implicit-conversions logImplicits.scala
logImplicits.scala:2: applied implicit conversion from xs.type to ?{val size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte]
def f(xs: Array[Byte]) = xs.size
^
Diffstat (limited to 'test/files/neg/logImplicits.scala')
-rw-r--r-- | test/files/neg/logImplicits.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/neg/logImplicits.scala b/test/files/neg/logImplicits.scala new file mode 100644 index 0000000000..fb5dd8a025 --- /dev/null +++ b/test/files/neg/logImplicits.scala @@ -0,0 +1,25 @@ +class A { + def f(xs: Array[Byte]) = xs.size + def g(xs: Array[Byte]) = xs.length +} + +class B { + def f = "abc" map (_ + 1) +} + +object C { + final val x = "abc" + + implicit def convert(p: x.type): Int = 123 + + math.max(122, x: Int) +} + +class D { + def f = (1 -> 2) + "c" +} + +class Un { + // forcing post-typer failure, since we're only interested in the output from the above + def unimplemented: Int +}
\ No newline at end of file |