We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7e2f80b + 63fe1c0 commit ed35fefCopy full SHA for ed35fef
tests/neg/i16842.scala
@@ -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