Skip to content

Commit 3fa3784

Browse files
author
Oron Port
committed
workaround scala/scala3#22023
1 parent 86bcafa commit 3fa3784

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

core/src/main/scala/dfhdl/core/DFVal.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ final class DFVal[+T <: DFTypeAny, +M <: ModifierAny](val irValue: ir.DFVal | DF
1919
with DFMember[ir.DFVal]
2020
with Selectable:
2121
type Fields = DFVal.Fields[T @uncheckedVariance, M @uncheckedVariance]
22-
23-
def selectDynamic(name: String)(using DFC): Any = trydf {
22+
// TODO: revert selectDynamic change once https://github.com/scala/scala3/issues/22023 is fixed
23+
inline def selectDynamic(name: String): Any = trydf {
24+
val dfc = compiletime.summonInline[DFC]
2425
val ir.DFStruct(structName, fieldMap) = this.asIR.dfType: @unchecked
2526
val dfType = fieldMap(name)
2627
DFVal.Alias
27-
.SelectField(this, name)
28+
.SelectField(this, name)(using dfc)
2829
.asIR
2930
.asVal[DFTypeAny, ModifierAny]
3031
}

core/src/test/scala/CoreSpec/DFTupleSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import munit.*
55
class DFTupleSpec extends DFSpec:
66
val tplA = (UInt(8), Bit, Bits(3))
77
val tplB = ((UInt(8), Bit), Bits(3))
8+
// TODO: change test to include `t15` once https://github.com/scala/scala3/issues/22023 is fixed
89
assertCodeString(
910
"""|val t1 = (UInt(8), Bit, Bits(3)) <> VAR init ((d"8'0", 1, b"000"), (d"8'22", 0, b"101"))
1011
|val t2 = ((UInt(8), Bit), Bits(3)) <> VAR init ((d"8'11", 1), b"010")
@@ -22,7 +23,6 @@ class DFTupleSpec extends DFSpec:
2223
|val t12 = t9(0)
2324
|val t13: (UInt[8], Bit) <> CONST = (d"8'8", 1)
2425
|val t14 = t1._1
25-
|val t15 = t2._1
2626
|val t16: UInt[8] <> CONST = t13._1
2727
|val t17: Bit <> CONST = t13._2
2828
|val t18: (Bits[4], Bit) <> CONST = (h"8", 1)

0 commit comments

Comments
 (0)