aboutsummaryrefslogtreecommitdiff
path: root/tests/run/array-addition.scala
Commit message (Collapse)AuthorAgeFilesLines
* Disallow taking a class tag of Nothing or Null.Martin Odersky2017-02-011-2/+2
| | | | | | | | It seems in most cases this leads to weird behavior and cause confusing error messages later. It also means we cannot create an Array[Nothing], except by passing the classtag explicitly.
* Do not check for ambiguous implicits in viewExistsMartin Odersky2015-06-221-0/+11
Previously `viewExists(X, Y)` failed if there were ambiguous implicit conversions from X to Y. This is too fragile, as demonstrated by test case run/array-addition.scala. Here, the `genericArrayOps` implicit was not inserted because its result type `Array[?T]` was deemed to be incompatible with `? { +: : ? }`. It was incompatible because there were multiple implicits that added :+ to arrays of various element types. But once `genericArrayOps` gets applied, the type parameter `?T` of the array result is fixed, and the ambuity goes away. The scenario shows that we should not test for ambiguous implicits in viewExists. Such a test is fragile because it depends on the progress of type inference when the test is made. It's preferable to just test for any implicit conversion to exist and to check for ambiguities later, when the implicit conversion is actually applied. This has also the potential of speeding up implicit search in situations where `viewExists` is called often (e.g. when coupled with overloading resolution).