@@ -324,7 +324,7 @@ object DFVal extends DFValLP:
324324 )(dfc : Expr [DFC ])(using Quotes , Type [T ], Type [M ], Type [R ], Type [Op ]): Expr [DFValTP [DFBool , Any ]] =
325325 import quotes .reflect .*
326326 if (TypeRepr .of[T ].typeSymbol equals defn.NothingClass )
327- return IsGiven .controlledMacroError (" This is fake" )
327+ return ControlledMacroError .report (" This is fake" )
328328 val exactInfo = arg.exactInfo
329329 val lpType = dfVal.asTerm.tpe.isConstTpe.asTypeOf[Any ]
330330 val rpType = exactInfo.exactTpe.isConstTpe.asTypeOf[Any ]
@@ -1358,7 +1358,7 @@ object VarsTuple:
13581358 println(tpe.widen.dealias.show)
13591359 Some (s " All tuple elements must be mutable but found an immutable type ` ${tpe.showType}` " )
13601360 varsCheck(tTpe) match
1361- case Some (err) => IsGiven .controlledMacroError (err)
1361+ case Some (err) => ControlledMacroError .report (err)
13621362 case None =>
13631363 import Width .calcValWidth
13641364 val widthType = tTpe.calcValWidth.asTypeOf[Int ]
@@ -1555,39 +1555,31 @@ object ConnectOps:
15551555 def connect (consumer : Consumer , producer : Producer )(using DFC ): Unit =
15561556 consumer.connect(tc(consumer.dfType, producer))
15571557
1558- private [core] transparent inline def specialConnect [
1559- L <: DFValAny ,
1560- R <: DFValAny
1561- ](
1558+ private def specialConnectRuntime [L <: DFValAny , R <: DFValAny ](
1559+ lhs : L ,
1560+ rhs : R ,
1561+ dualSummon : DualSummonTrapError [TC_Connect [L , R ], TC_Connect [R , L ]]
1562+ )(using dfc : DFC ): Unit = trydf {
1563+ (dualSummon.valueL, dualSummon.valueR) match
1564+ case (Some (tcL), Some (tcR)) =>
1565+ try tcL.connect(lhs, rhs)
1566+ catch
1567+ case eL : Throwable =>
1568+ try tcR.connect(rhs, lhs)
1569+ catch case eR : Throwable => throw eL
1570+ case (Some (tcL), None ) => tcL.connect(lhs, rhs)
1571+ case (None , Some (tcR)) => tcR.connect(rhs, lhs)
1572+ case _ => // not possible because of the trap error
1573+ end match
1574+ }(using dfc, CTName (" <>" ))
1575+
1576+ private [core] transparent inline def specialConnect [L <: DFValAny , R <: DFValAny ](
15621577 inline lhs : L ,
15631578 inline rhs : R
1564- )(using DFC ): Unit =
1565- inline val connectableL = inline compiletime.erasedValue[L ] match
1566- case _ : DFVal [DFTypeAny , Modifier [Any , Modifier .Connectable , Any , Any ]] => true
1567- case _ => false
1568- inline val connectableR = inline compiletime.erasedValue[R ] match
1569- case _ : DFVal [DFTypeAny , Modifier [Any , Modifier .Connectable , Any , Any ]] => true
1570- case _ => false
1571- inline if (connectableL || connectableR)
1572- inline if (IsGiven [TC_Connect [L , R ]])
1573- val tcL = compiletime.summonInline[TC_Connect [L , R ]]
1574- inline if (IsGiven [TC_Connect [R , L ]])
1575- val tcR = compiletime.summonInline[TC_Connect [R , L ]]
1576- try tcL.connect(lhs, rhs)
1577- catch
1578- case eL : Throwable =>
1579- try tcR.connect(rhs, lhs)
1580- catch case eR : Throwable => throw eL
1581- else tcL.connect(lhs, rhs)
1582- else if (IsGiven [TC_Connect [R , L ]])
1583- compiletime.summonInline[TC_Connect [R , L ]].connect(rhs, lhs)
1584- else
1585- // forcing the error message from the LHS case
1586- compiletime.summonInline[TC_Connect [L , R ]]
1587- else compiletime.error(
1588- " At least one of the connection arguments must be a connectable DFHDL value (var/port)."
1589- )
1590- end if
1579+ )(using dfc : DFC ): Unit =
1580+ val dualSummon =
1581+ compiletime.summonInline[DualSummonTrapError [TC_Connect [L , R ], TC_Connect [R , L ]]]
1582+ specialConnectRuntime(lhs, rhs, dualSummon)
15911583 end specialConnect
15921584
15931585 given evConnectPort [
0 commit comments