diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-04-02 11:24:27 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-04-02 11:59:02 +0200 |
commit | d1c7f8d451d29f6f5d7ccf665c35acbe96ed4680 (patch) | |
tree | d2de3478d169f1e96ce39aaa8ef3e13d9ccfc152 /test/files/neg/t8463.scala | |
parent | 8489be16b57a08f51bf3655c99cede52477b3022 (diff) | |
download | scala-d1c7f8d451d29f6f5d7ccf665c35acbe96ed4680.tar.gz scala-d1c7f8d451d29f6f5d7ccf665c35acbe96ed4680.tar.bz2 scala-d1c7f8d451d29f6f5d7ccf665c35acbe96ed4680.zip |
SI-8463 Avoid unpositioned errors from search for views
Ideally, I'd like to fix this using `saveErrors = false` here to
firewall the enclosing context from the ambiguiouty error encountered
during implicit search.
I originally proposed that patch as a fix for SI-8419 in
https://github.com/scala/scala/pull/3460 but withdrew from
that approach as I uncovered a deeper bug that meant that
we actually shouldn't have even been looking for views in
that case.
But, this runs into SI-8230 and these failures:
test/partest --update-check \
/Users/jason/code/scala/test/files/pos/t2504.scala \
/Users/jason/code/scala/test/files/pos/t4457_1.scala \
/Users/jason/code/scala/test/files/neg/t4457_2.scala
Turns out that typechecking the ostensible straight forward
application, `Array("abc")`, hinges on us leaking an ambiguity
error from `viewExists` to find a path through overload resolution!
This commit takes a tiny step forward by using `context.tree`
rather than `EmptyTree` as the argument to `inferImplicit`.
This avoids unpositioned type errors.
Diffstat (limited to 'test/files/neg/t8463.scala')
-rw-r--r-- | test/files/neg/t8463.scala | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/files/neg/t8463.scala b/test/files/neg/t8463.scala new file mode 100644 index 0000000000..7c954fd834 --- /dev/null +++ b/test/files/neg/t8463.scala @@ -0,0 +1,38 @@ +object Test { + case class Foo[+T[_]](activity:T[Long]) + type Cell[T] = T + def insertCell(u:Foo[Cell]) = ??? + insertCell(Foo(5)) +} + +/* If SI-8230 is fixed, and `viewExists` is changed to no longer leak + ambiguity errors, you might expect the check file for this test to + change as folloes: + +@@ -1,18 +1,10 @@ +-t8463.scala:5: error: no type parameters for method apply: (activity: +- --- because --- +-argument expression's type is not compatible with formal parameter ty ++t8463.scala:5: error: type mismatch; + found : Long + required: ?T[Long] ++Note that implicit conversions are not applicable because they are am ++ both method longWrapper in class LowPriorityImplicits of type (x: Lo ++ and method ArrowAssoc in object Predef of type [A](self: A)ArrowAsso ++ are possible conversion functions from Long to ?T[Long] + insertCell(Foo(5)) +- ^ +-t8463.scala:5: error: type mismatch; +- found : Long(5L) +- required: T[Long] +- insertCell(Foo(5)) +- ^ +-t8463.scala:5: error: type mismatch; +- found : Test.Foo[T] +- required: Test.Foo[Test.Cell] +- insertCell(Foo(5)) +- ^ +-three errors found ++ ^ ++one error found +*/ |