diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-08 11:35:05 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-03-08 17:50:20 +0100 |
commit | f07697b25294eaafb1c86698c44a699ec1c0d1ba (patch) | |
tree | 5a08ac595fc61bfa467ce987728bee6d51839306 /tests/run/t8280.scala | |
parent | c84480960cf618c29705dbaab9332d304a081524 (diff) | |
download | dotty-f07697b25294eaafb1c86698c44a699ec1c0d1ba.tar.gz dotty-f07697b25294eaafb1c86698c44a699ec1c0d1ba.tar.bz2 dotty-f07697b25294eaafb1c86698c44a699ec1c0d1ba.zip |
Disallow subtypes of Function1 acting as implicit conversions
The new test `falseView.scala` shows the problem. We might create
an implicit value of some type that happens to be a subtype of Function1.
We might now expect that this gives us an implicit conversion, this
is most often unintended and surprising.
See the comment in Implicits#discardForView for a discussion why
we picked the particular scheme implemented here.
Diffstat (limited to 'tests/run/t8280.scala')
-rw-r--r-- | tests/run/t8280.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala index f433dcc32..1d2c56b85 100644 --- a/tests/run/t8280.scala +++ b/tests/run/t8280.scala @@ -37,7 +37,8 @@ object Moop1 { implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" } implicit val f2: Long => String = _ => "Long" - println(5: String) + //println(5: String) + // This picked f1 before, but is now disallowed since subtypes of functions are no longer implicit conversions } } |