Skip to content

Commit fd7a463

Browse files
Add test for #20377 fixed in #20504
1 parent 0e36424 commit fd7a463

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: tests/pos/i20377.scala

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import language.experimental.namedTuples
2+
import NamedTuple.{NamedTuple, AnyNamedTuple}
3+
4+
// Repros for bugs or questions
5+
class ClassToMap[A]()
6+
abstract class ClassToFind[Rows <: AnyNamedTuple]:
7+
def mapped: NamedTuple.Map[Rows, ClassToMap]
8+
9+
given TDB: ClassToFind[(t1: Int, t2: String)] with
10+
override def mapped = (
11+
t1 = ClassToMap[Int](),
12+
t2 = ClassToMap[String]()
13+
)
14+
15+
type TypeAlias = (t1: Int, t2: String)
16+
class Repro1_Pass(using val testDB: ClassToFind[TypeAlias]) {
17+
def query() =
18+
testDB.mapped.t1
19+
}
20+
class Repro1_Fail(using val testDB: ClassToFind[(t1: Int, t2: String)]) {
21+
def query() =
22+
testDB.mapped.t1 // fails to compile
23+
}

0 commit comments

Comments
 (0)