Skip to content

Commit 13da5f5

Browse files
[Scala3] Support multiple parameter lists for Bundles (#5085)
1 parent e9a73eb commit 13da5f5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugin/src/main/scala-3/chisel3/internal/plugin/BundlePhase.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ object BundleHelpers {
3838
thiz: tpd.This,
3939
conArgs: List[List[tpd.Tree]]
4040
)(using Context): tpd.DefDef = {
41-
val newExpr = tpd.New(record.symbol.typeRef, conArgs.flatten)
41+
val newExpr: tpd.Tree = conArgs match {
42+
case Nil => tpd.New(record.symbol.typeRef, Nil)
43+
case head :: tail =>
44+
val headApp = tpd.New(record.symbol.typeRef, head)
45+
tail.foldLeft(headApp: tpd.Tree) { (fun, args) =>
46+
tpd.Apply(fun, args)
47+
}
48+
}
4249
val recordTpe = requiredClassRef("chisel3.Record")
4350
val cloneTypeSym = newSymbol(
4451
record.symbol,

0 commit comments

Comments
 (0)