Skip to content

Commit 0fb1498

Browse files
author
Oron Port
committed
workaround scala/scala3#24076
1 parent 3f5adfa commit 0fb1498

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,16 +1239,21 @@ object DFVal extends DFValLP:
12391239
transparent inline def <~>(inline rhs: Any)(using DFC): Any =
12401240
// operator `<>` as a constructor is unidirectional
12411241
// operator `<>` as a connection is bidirectional and commutative
1242-
inline (lhs, rhs) match
1243-
// if the RHS is a modifier, this is a port/variable constructor,
1244-
// so we invoke the the implicit given operation only in one way
1245-
case (_, _: ModifierAny) => exactOp2["<>", DFC, Any](lhs, rhs)
1246-
// if both LHS and RHS are DFVals, we call `specialConnect` to handle possible
1247-
// connection in either direction where both implicit directions are available
1248-
case (lhs: DFVal[lt, lm], rhs: DFVal[rt, rm]) => ConnectOps.specialConnect(lhs, rhs)
1249-
// otherwise, we invoke the implicit given operation in both directions by turning
1250-
// on the bothWays flag for all other cases
1251-
case _ => exactOp2["<>", DFC, Any](lhs, rhs, bothWays = true)
1242+
// TODO: possibly use match on lhs and rhs together fixing scalac issue
1243+
// https://github.com/scala/scala3/issues/24076
1244+
inline lhs match
1245+
case lhs: DFVal[lt, lm] => rhs match
1246+
// if both LHS and RHS are DFVals, we call `specialConnect` to handle possible
1247+
// connection in either direction where both implicit directions are available
1248+
case rhs: DFVal[rt, rm] => ConnectOps.specialConnect(lhs, rhs)
1249+
// otherwise, we invoke the implicit given operation in both directions by turning
1250+
// on the bothWays flag for all other cases
1251+
case _ => exactOp2["<>", DFC, Any](lhs, rhs, bothWays = true)
1252+
case _ => rhs match
1253+
// if the RHS is a modifier, this is a port/variable constructor,
1254+
// so we invoke the the implicit given operation only in one way
1255+
case _: ModifierAny => exactOp2["<>", DFC, Any](lhs, rhs)
1256+
case _ => exactOp2["<>", DFC, Any](lhs, rhs, bothWays = true)
12521257
end match
12531258
end extension
12541259

0 commit comments

Comments
 (0)