Skip to content

Commit 03dd024

Browse files
author
Oron Port
committed
fix cache read of IntParamRef
1 parent 7442af2 commit 03dd024

File tree

1 file changed

+3
-3
lines changed
  • compiler/ir/src/main/scala/dfhdl/compiler/ir

1 file changed

+3
-3
lines changed

compiler/ir/src/main/scala/dfhdl/compiler/ir/DFRef.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ object IntParamRef:
9696
(intParamRef, that) match
9797
case (thisRef: DFRef.TypeRef, thatRef: DFRef.TypeRef) =>
9898
thisRef.get.isSimilarTo(thatRef.get)
99-
case (thisInt: Int, thatInt: Int) => thisInt == thatInt
99+
case (thisInt: Int, thatInt: Int) => thisInt == thatInt
100100
case (thisRef: DFRef.TypeRef, thatInt: Int) =>
101101
thisRef.get.isSimilarTo(fakeConst(thatInt))
102102
case (thisInt: Int, thatRef: DFRef.TypeRef) =>
@@ -114,16 +114,16 @@ object IntParamRef:
114114
,
115115
json =>
116116
json match
117-
case ujson.Str(s) => read[DFRef.TypeRef](s)
118117
case ujson.Num(n) => n.toInt
118+
case ujson.Str(_) => read[DFRef.TypeRef](json)
119119
case _ => throw new IllegalArgumentException(s"Expected String or Int, got $json")
120120
)
121121
end IntParamRef
122122

123123
extension (intCompanion: Int.type)
124124
def unapply(intParamRef: IntParamRef)(using MemberGetSet): Option[Int] =
125125
(intParamRef: @unchecked) match
126-
case int: Int => Some(int)
126+
case int: Int => Some(int)
127127
case DFRef(dfVal: DFVal) =>
128128
dfVal.getConstData.asInstanceOf[Option[Option[BigInt]]].flatten.map(_.toInt)
129129

0 commit comments

Comments
 (0)