Hi guys, I'll say right away that I'm not a macro wizard, but this one works correctly with nim 2.2.x and with 2.3.1 it gives me an error...
# Versione intelligente con argomento aggiuntivo
macro connect*[T](widgetCall: untyped; widgetSignal: untyped; callFunction: untyped; functionArg: T) =
let signalParameterTypes = getSignalParameterTypes()
let signalStr = $widgetSigna@
# Prova a ottenere il tipo del widget
let widgetType = widgetCall.getType() à< -- Error!!!!! Error: node has no type
let widgetTypeName = extractType(widgetType)
# Controlla se è un segnale speciale
if signalStr in signalParameterTypes and ecexioniXX(widgetTypeName) == false:
# Widget normale - usa il wrapper del tipo slot
echo "Debug - Widget type name: ", widgetTypeName
let paramType = signalParameterTypes[signalStr]
let slotType = buildSlotName(widgetTypeName, signalStr)
echo "Debug - Generated slot type: ", $slotType
# Genera il codice per segnali speciali (con parametri)
result = quote do:
`widgetCall`.`widgetSignal`(`slotType`(proc(qtArg: `paramType`) {.closure.} = `callFunction`(`functionArg`)))
elif signalStr in signalParameterTypes and ecexioniXX(widgetTypeName) == true:
# Widget con eccezione - NON usa il wrapper del tipo slot
echo "Debug - Widget type name (eccezione): ", widgetTypeName
let paramType = signalParameterTypes[signalStr]
echo "Debug - Usando connessione diretta (senza slot type wrapper)"
# Genera il codice per segnali speciali (con parametri) ma senza wrapper
result = quote do:
`widgetCall`.`widgetSignal`((proc(qtArg: `paramType`) {.closure.} = `callFunction`(`functionArg`)))
else:
# Genera il codice per segnali classici (senza parametri)
result = quote do:
`widgetCall`.`widgetSignal`(proc() {.closure.} = `callFunction`(`functionArg`)) the error:
stack trace: (most recent call last)
/home/andrea/Scrivania/MainWindow_34/qtconnect.nim(126, 30) connect
/home/andrea/Scrivania/MainWindow_34/mainwindow_34.nim(42, 10) template/generic instantiation of `connect` from here
/home/andrea/Scrivania/MainWindow_34/qtconnect.nim(126, 30) Error: node has no type in short, has anything changed compared to 2.2.x (where it compiles perfectly), if so how do I treat the patient? A thousand thanks! by Martinix75Ciao, odd minor version are unreleased, thus can be unstable. You can find the draft changelog here -- skimming it I don't seem to read something related, but the changelog is partial, so you can try to skim the git log.
May I ask why are you using an unstable version?