aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-18 15:15:42 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-22 11:42:05 +0200
commitc3bcad807db47ee4ab27ac4a725ba5f402667b4d (patch)
tree2d80305765fd763574b36c47d6a413179eee3860 /tests
parent204158d4141254d1148534e14d3d26b361b7bc12 (diff)
downloaddotty-c3bcad807db47ee4ab27ac4a725ba5f402667b4d.tar.gz
dotty-c3bcad807db47ee4ab27ac4a725ba5f402667b4d.tar.bz2
dotty-c3bcad807db47ee4ab27ac4a725ba5f402667b4d.zip
Do not check for ambiguous implicits in viewExists
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).
Diffstat (limited to 'tests')
-rw-r--r--tests/run/array-addition.check (renamed from tests/pending/run/array-addition.check)0
-rw-r--r--tests/run/array-addition.scala (renamed from tests/pending/run/array-addition.scala)0
2 files changed, 0 insertions, 0 deletions
diff --git a/tests/pending/run/array-addition.check b/tests/run/array-addition.check
index 7bfbd9c71..7bfbd9c71 100644
--- a/tests/pending/run/array-addition.check
+++ b/tests/run/array-addition.check
diff --git a/tests/pending/run/array-addition.scala b/tests/run/array-addition.scala
index 8def48e85..8def48e85 100644
--- a/tests/pending/run/array-addition.scala
+++ b/tests/run/array-addition.scala