Skip to content

Commit 4916e43

Browse files
committed
More tests that work now
1 parent ba970c4 commit 4916e43

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

tests/pos/i15160.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
trait Eq[A] {
2+
def eqv(a1: A, a2: A): Boolean
3+
}
4+
5+
given stringEq: Eq[String] with {
6+
def eqv(a1: String, a2: String) = a1 == a2
7+
}
8+
9+
abstract class Newtype[Src] {
10+
opaque type Type = Src
11+
12+
protected final def derive[F[_]](using ev: F[Src]): F[Type] = ev
13+
}
14+
15+
object Sample extends Newtype[String] {
16+
given eq: Eq[Type] = derive
17+
}

tests/pos/i15670.scala

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
trait JsonRowEntry {
2+
def readAs[E](implicit c: Read[E]): Option[E] = ???
3+
}
4+
trait Read[T]
5+
trait Codec[T] extends Read[T]
6+
trait CodecTypeProjection[C[_]]
7+
object JsonTransform {
8+
given SetCodec[T, C[_]: CodecTypeProjection]: scala.Conversion[C[T], C[Set[T]]] = ???
9+
given SetCodecExp[T, C[_]: CodecTypeProjection](using codec: C[T]): C[Set[T]] = codec
10+
given Codec[String] = ???
11+
given CodecTypeProjection[Read] = ???
12+
}
13+
14+
@main def Test() = {
15+
import JsonTransform.given
16+
val tree = new JsonRowEntry {}
17+
tree.readAs[Set[String]]
18+
}
19+
20+
trait Box[E]
21+
22+
trait Domain
23+
24+
def fun[E, D[_] <: Domain](box: Box[E])(implicit domain: D[E]): Unit = {
25+
26+
val newBox: Box[E] = ???
27+
28+
fun(newBox)
29+
}

tests/pos/i15820.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sealed trait Domain[E]
2+
3+
final def splitBounds[E, D[X] <: Domain[X]](
4+
bounds: Seq[E],
5+
)( using domain: D[E]): Seq[E] =
6+
val newBounds: Seq[E] = ???
7+
splitBounds(newBounds) // does not compile
8+
splitBounds[E,D](newBounds) // does compile

0 commit comments

Comments
 (0)