Skip to content

Commit 63fe1c0

Browse files
committed
Add regression tests
Closes #16842
1 parent 723d140 commit 63fe1c0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/neg/i16842.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
sealed trait Expr1
2+
sealed trait Literal extends Expr1
3+
4+
case class ArrayLiter(elems: List[Expr1]) extends Literal
5+
6+
sealed trait SemanticType {
7+
type T // the type with which a literal of this semanticType is represented
8+
}
9+
case object SemanticInt extends SemanticType {
10+
type T = Int
11+
}
12+
13+
case class SemanticArray[U <: SemanticType](dim: Int) extends SemanticType {
14+
type T = List[U]
15+
}
16+
17+
sealed trait Expr2[+T]
18+
class Liter[T <: SemanticType](val ty: T, val value: ty.T) extends Expr2[T]
19+
20+
def typecheckArrayLiter(
21+
a: ArrayLiter
22+
): Liter[SemanticArray[SemanticType]] = {
23+
val x: List[Expr2[SemanticInt.type]] = List()
24+
Liter(SemanticArray[SemanticInt.type], x) // error // error
25+
}

0 commit comments

Comments
 (0)