Skip to content

Commit 06747da

Browse files
oderskyEugeneFlesselle
authored andcommitted
Add tests
1 parent cd8c5ed commit 06747da

9 files changed

+29
-20
lines changed

tests/neg/given-triangle.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- [E172] Type Error: tests/neg/given-triangle.scala:14:18 -------------------------------------------------------------
2+
14 |@main def Test = f // error
3+
| ^
4+
|Ambiguous given instances: both given instance given_B and given instance given_C match type A of parameter a of method f

tests/warn/given-triangle.scala renamed to tests/neg/given-triangle.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -source 3.6-migration
2-
31
class A
42
class B extends A
53
class C extends A
@@ -13,4 +11,4 @@ def f(using a: A, b: B, c: C) =
1311
println(b.getClass)
1412
println(c.getClass)
1513

16-
@main def Test = f // warn
14+
@main def Test = f // error
File renamed without changes.
File renamed without changes.

tests/pos/i20572.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//> using options -Werror
2+
trait Writes[T]
3+
trait Format[T] extends Writes[T]
4+
given [T: List]: Writes[T] = null
5+
given [T]: Format[T] = null
6+
7+
val _ = summon[Writes[Int]]

tests/pos/i21036.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//> using options -source 3.5 -Werror
2+
trait SameRuntime[A, B]
3+
trait BSONWriter[T]
4+
trait BSONHandler[T] extends BSONWriter[T]
5+
6+
opaque type Id = String
7+
object Id:
8+
given SameRuntime[Id, String] = ???
9+
10+
given BSONHandler[String] = ???
11+
given [T: BSONHandler]: BSONHandler[List[T]] = ???
12+
13+
given opaqueWriter[T, A](using rs: SameRuntime[T, A], writer: BSONWriter[A]): BSONWriter[T] = ???
14+
15+
val x = summon[BSONHandler[List[Id]]] // this doesn't emit warning
16+
val y = summon[BSONWriter[List[Id]]] // this did emit warning

tests/run/given-triangle.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import language.future
1+
import language.`3.6`
22

33
class A
44
class B extends A

tests/warn/bson.check

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/warn/given-triangle.check

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)