Skip to content

Commit 93510a9

Browse files
committed
Add failing test for scala#8827
1 parent 89de881 commit 93510a9

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tests/neg/i8827.check

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- [E172] Type Error: tests/neg/i8827.scala:22:26 ----------------------------------------------------------------------
2+
22 | summon[Order[List[Foo]]] // error
3+
| ^
4+
| No given instance of type pkg.Order[List[pkg.Foo]] was found for parameter x of method summon in object Predef.
5+
| I found:
6+
|
7+
| pkg.Order.orderList[pkg.Foo](/* missing */summon[pkg.Order[pkg.Foo]])
8+
|
9+
| But no implicit values were found that match type pkg.Order[pkg.Foo].
10+
|
11+
| One of the following imports might fix the problem:
12+
|
13+
| import pkg.Implicits.orderFoo
14+
| import pkg.Givens.orderFoo
15+
-- [E172] Type Error: tests/neg/i8827.scala:23:28 ----------------------------------------------------------------------
16+
23 | summon[Order[Option[Foo]]] // error
17+
| ^
18+
|No given instance of type pkg.Order[Option[pkg.Foo]] was found for parameter x of method summon in object Predef.
19+
|I found:
20+
|
21+
| pkg.Order.given_Order_Option[pkg.Foo](/* missing */summon[pkg.Order[pkg.Foo]])
22+
|
23+
|But no implicit values were found that match type pkg.Order[pkg.Foo].
24+
|
25+
|One of the following imports might fix the problem:
26+
|
27+
| import pkg.Implicits.orderFoo
28+
| import pkg.Givens.orderFoo

tests/neg/i8827.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package pkg
2+
3+
trait Order[A]
4+
5+
object Order {
6+
implicit def orderList[A](implicit orderA: Order[A]): Order[List[A]] = ???
7+
8+
given [A](using orderA: Order[A]): Order[Option[A]] = ???
9+
}
10+
11+
class Foo
12+
13+
object Implicits {
14+
implicit def orderFoo: Order[Foo] = ???
15+
}
16+
17+
object Givens {
18+
given orderFoo: Order[Foo] = ???
19+
}
20+
21+
@main def main: Unit =
22+
summon[Order[List[Foo]]] // error
23+
summon[Order[Option[Foo]]] // error

0 commit comments

Comments
 (0)