Skip to content

Commit d7e97f7

Browse files
author
Alexey Romanov
committed
Fixed structName for structures containing arrays
1 parent 5cd7f3e commit d7e97f7

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

src/common/Structs.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ trait StructExp extends StructOps with StructTags with BaseExp with EffectExp wi
178178
// FIXME: move to codegen? we should be able to have different policies/naming schemes
179179
case rm: RefinedManifest[_] => "Anon" + math.abs(rm.fields.map(f => f._1.## + f._2.toString.##).sum)
180180
case _ if (m <:< manifest[AnyVal]) => m.toString
181+
case _ if m.erasure.isArray => "ArrayOf" + structName(m.typeArguments.head)
181182
case _ => m.erasure.getSimpleName + m.typeArguments.map(a => structName(a)).mkString("")
182183
}
183184

test-out/epfl/test9-struct2.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ x2
2525
}
2626
val x16 = x0 > 7
2727
val x21 = if (x16) {
28-
val x6 = new Record[]Anon189207751(x4,x5)
28+
val x6 = new ArrayOfAnon189207751(x4,x5)
2929
x6
3030
} else {
3131
val x17 = x13
3232
val x18 = x14
33-
val x19 = new Record[]Anon189207751(x17,x18)
33+
val x19 = new ArrayOfAnon189207751(x17,x18)
3434
x19
3535
}
3636
x13 = x4
3737
x14 = x5
3838
val x24 = x13
3939
val x25 = x14
40-
val x26 = new Record[]Anon189207751(x24,x25)
40+
val x26 = new ArrayOfAnon189207751(x24,x25)
4141
val x27 = println(x26)
4242
val x28 = println(x21)
4343
x28
@@ -47,4 +47,4 @@ x28
4747
End of Generated Code
4848
*******************************************/
4949

50-
case class Record[]Anon189207751(re: Array[Double], im: Array[Int])
50+
case class ArrayOfAnon189207751(re: Array[Double], im: Array[Int])

test-out/epfl/test9-struct2b.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ x13 = x11
3434
x14 = x10
3535
val x42 = x13
3636
val x43 = x14
37-
val x44 = new Record[]Anon189207751(x42,x43)
37+
val x44 = new ArrayOfAnon189207751(x42,x43)
3838
val x45 = println(x44)
39-
val x46 = new Record[]Anon189207751(x38,x39)
39+
val x46 = new ArrayOfAnon189207751(x38,x39)
4040
val x47 = println(x46)
4141
val x36 = x47
4242
x36
@@ -46,4 +46,4 @@ x36
4646
End of Generated Code
4747
*******************************************/
4848

49-
case class Record[]Anon189207751(re: Array[Int], im: Array[Double])
49+
case class ArrayOfAnon189207751(re: Array[Int], im: Array[Double])

test-out/epfl/test9-struct3.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var x4 = new Array[Int](100)
1818
for (x1 <- 0 until 100) {
1919
x4(x1) = x1
2020
}
21-
val x17 = new Record[]Anon189207751(x4,x4)
21+
val x17 = new ArrayOfAnon189207751(x4,x4)
2222
val x18 = println(x17)
2323
val x15 = x18
2424
x15
@@ -28,4 +28,4 @@ x15
2828
End of Generated Code
2929
*******************************************/
3030

31-
case class Record[]Anon189207751(re: Array[Int], im: Array[Int])
31+
case class ArrayOfAnon189207751(re: Array[Int], im: Array[Int])

test-out/epfl/test9-struct4.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ x23
3434
} else {
3535
x5
3636
}
37-
val x27 = new Record[]Anon189207751(x4,x26)
37+
val x27 = new ArrayOfAnon189207751(x4,x26)
3838
val x28 = println(x27)
3939
x28
4040
}
@@ -43,4 +43,4 @@ x28
4343
End of Generated Code
4444
*******************************************/
4545

46-
case class Record[]Anon189207751(re: Array[Int], im: Array[Double])
46+
case class ArrayOfAnon189207751(re: Array[Int], im: Array[Double])

0 commit comments

Comments
 (0)