Skip to content

Commit 2ee7f74

Browse files
authored
Merge pull request #12923 from dotty-staging/test-12910
Add regression test
2 parents 8163bff + d87b9c2 commit 2ee7f74

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/pos/i12910.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
trait Type[T]:
2+
type Out
3+
4+
type varchar
5+
6+
given Type[varchar] with
7+
type Out = String
8+
9+
class Placeholder[T, U]
10+
11+
object Placeholder:
12+
def apply[T](using t: Type[T]): Placeholder[T, t.Out] = new Placeholder
13+
14+
trait Encoder[P, X]:
15+
def encode(x: X): String
16+
17+
object Encoder:
18+
def apply[P, X](placeholder: P)(using e: Encoder[P, X]): X => String = e.encode
19+
20+
given [T, X]: Encoder[Placeholder[T, X], X] with
21+
def encode(x: X): String = ???
22+
23+
def Test =
24+
// the following compiles just fine
25+
Encoder(new Placeholder[varchar, String])("hello")
26+
// the following fails
27+
Encoder(Placeholder[varchar])("hello")

0 commit comments

Comments
 (0)