Skip to content

Commit 70eb093

Browse files
committed
More splitting missing implicits tests
1 parent 140a2ef commit 70eb093

File tree

4 files changed

+40
-26
lines changed

4 files changed

+40
-26
lines changed

tests/neg/missing-implicit1.check

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,3 @@
2525
|
2626
| import testObjectInstance.instances.zipOption
2727
|
28-
-- [E008] Not Found Error: tests/neg/missing-implicit1.scala:26:16 -----------------------------------------------------
29-
26 | List(1, 2, 3).first // error
30-
| ^^^^^^^^^^^^^^^^^^^
31-
| value first is not a member of List[Int], but could be made available as an extension method.
32-
|
33-
| The following import might fix the problem:
34-
|
35-
| import testObjectInstance.instances.first
36-
|
37-
-- [E008] Not Found Error: tests/neg/missing-implicit1.scala:27:16 -----------------------------------------------------
38-
27 | List(1, 2, 3).second // error
39-
| ^^^^^^^^^^^^^^^^^^^^
40-
| value second is not a member of List[Int], but could be made available as an extension method.
41-
|
42-
| The following import might fix the problem:
43-
|
44-
| import testObjectInstance.instances.listExtension
45-
|
46-
-- [E008] Not Found Error: tests/neg/missing-implicit1.scala:28:17 -----------------------------------------------------
47-
28 | Array(1, 2, 3).first // error, no hint
48-
| ^^^^^^^^^^^^^^^^^^^^
49-
| value first is not a member of Array[Int]

tests/neg/missing-implicit1.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,4 @@ object testObjectInstance:
2222
import instances.traverseList
2323
List(1, 2, 3).traverse(x => Option(x)) // error
2424
}
25-
26-
List(1, 2, 3).first // error
27-
List(1, 2, 3).second // error
28-
Array(1, 2, 3).first // error, no hint
2925
end testObjectInstance

tests/neg/missing-implicit5.check

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- [E008] Not Found Error: tests/neg/missing-implicit5.scala:15:16 -----------------------------------------------------
2+
15 | List(1, 2, 3).first // error
3+
| ^^^^^^^^^^^^^^^^^^^
4+
| value first is not a member of List[Int], but could be made available as an extension method.
5+
|
6+
| The following import might fix the problem:
7+
|
8+
| import testObjectInstance.instances.first
9+
|
10+
-- [E008] Not Found Error: tests/neg/missing-implicit5.scala:16:16 -----------------------------------------------------
11+
16 | List(1, 2, 3).second // error
12+
| ^^^^^^^^^^^^^^^^^^^^
13+
| value second is not a member of List[Int], but could be made available as an extension method.
14+
|
15+
| The following import might fix the problem:
16+
|
17+
| import testObjectInstance.instances.listExtension
18+
|
19+
-- [E008] Not Found Error: tests/neg/missing-implicit5.scala:17:17 -----------------------------------------------------
20+
17 | Array(1, 2, 3).first // error, no hint
21+
| ^^^^^^^^^^^^^^^^^^^^
22+
| value first is not a member of Array[Int]

tests/neg/missing-implicit5.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
object testObjectInstance:
2+
trait Zip[F[_]]
3+
trait Traverse[F[_]] {
4+
def [A, B, G[_] : Zip](fa: F[A]) traverse(f: A => G[B]): G[F[B]]
5+
}
6+
7+
object instances {
8+
given zipOption as Zip[Option] = ???
9+
given traverseList as Traverse[List] = ???
10+
extension listExtension on [T](xs: List[T]):
11+
def second: T = xs.tail.head
12+
def [T](xs: List[T]) first: T = xs.head
13+
}
14+
15+
List(1, 2, 3).first // error
16+
List(1, 2, 3).second // error
17+
Array(1, 2, 3).first // error, no hint
18+
end testObjectInstance

0 commit comments

Comments
 (0)