Skip to content

Commit fb10bdc

Browse files
committed
Bugfix withChildren for PAdt
1 parent c918d6f commit fb10bdc

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/scala/viper/silver/plugin/standard/adt/AdtPASTExtension.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ case class PAdt(idndef: PIdnDef, typVars: Seq[PTypeVarDecl], constructors: Seq[P
8989
adtType
9090
}
9191

92+
override def withChildren(children: Seq[Any], pos: Option[(Position, Position)] = None, forceRewrite: Boolean = false): this.type = {
93+
if (!forceRewrite && this.children == children && pos.isEmpty)
94+
this
95+
else {
96+
assert(children.length == 4, s"PAdt : expected length 4 but got ${children.length}")
97+
val first = children(0).asInstanceOf[PIdnDef]
98+
val second = children(1).asInstanceOf[Seq[PTypeVarDecl]]
99+
val third = children(2).asInstanceOf[Seq[PAdtConstructor]]
100+
val fourth = children(3).asInstanceOf[Seq[PAdtDerivingInfo]]
101+
PAdt(first, second, third, fourth)(pos.getOrElse(this.pos), annotations).asInstanceOf[this.type]
102+
}
103+
}
92104
}
93105

94106
object PAdt {

0 commit comments

Comments
 (0)