From 309a1f79b38da87ef66062555a23e11aad9e44d0 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sat, 26 Apr 2025 00:05:34 -0400 Subject: [PATCH 01/17] idk --- compiler/semexprs.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 55a58c7f04e4..e220014d3a67 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1094,6 +1094,14 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) return + elif n0.kind == nkDotExpr and n[0].typ().kind == tyTypeDesc: + result = n0 + result.transitionSonsKind(nkCall) + for i in 1.. Date: Sat, 26 Apr 2025 01:59:38 -0400 Subject: [PATCH 02/17] test and change --- compiler/semexprs.nim | 2 +- tests/exprs/tdots.nim | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/exprs/tdots.nim diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index e220014d3a67..fabaae620020 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1094,7 +1094,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) return - elif n0.kind == nkDotExpr and n[0].typ().kind == tyTypeDesc: + elif n0.kind == nkDotExpr and n0.typ.kind != tyProc: result = n0 result.transitionSonsKind(nkCall) for i in 1.. Date: Sat, 26 Apr 2025 04:21:58 -0400 Subject: [PATCH 03/17] patch --- compiler/semexprs.nim | 2 +- tests/exprs/tdots.nim | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index fabaae620020..a454100895e7 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1094,7 +1094,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) return - elif n0.kind == nkDotExpr and n0.typ.kind != tyProc: + elif n0.kind == nkDotExpr and n0.typ.kind notin {tyProc, tyGenericInst}: result = n0 result.transitionSonsKind(nkCall) for i in 1.. Date: Sat, 26 Apr 2025 13:56:19 -0400 Subject: [PATCH 04/17] fix test --- tests/exprs/tdots.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/exprs/tdots.nim b/tests/exprs/tdots.nim index 32c427f24a6d..b8cecbc70990 100644 --- a/tests/exprs/tdots.nim +++ b/tests/exprs/tdots.nim @@ -27,7 +27,7 @@ block: proc p(x: Rule[int]; y: float): int = 5 proc sp(y: int): int = 3 - proc spring*[T](rule: Rule[T]) = + proc spring[T](rule: Rule[T]) = let p = proc (text: T) = doAssert rule.p(text) == 3 p(default(T)) @@ -42,7 +42,7 @@ block: proc p(x: Rule[int]; y: int): int = 5 - proc spring*[T](rule: Rule[T]) = + proc spring[T](rule: Rule[T]) = let p = proc (x: T) = doAssert rule.p(x) == 5 p(default(T)) From a9a2f447882d54c7297ecd78340ed7914283c558 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sat, 26 Apr 2025 15:43:01 -0400 Subject: [PATCH 05/17] owned --- compiler/semexprs.nim | 2 +- tests/exprs/tdots.nim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index a454100895e7..590cc396bc43 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1094,7 +1094,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) return - elif n0.kind == nkDotExpr and n0.typ.kind notin {tyProc, tyGenericInst}: + elif n0.kind == nkDotExpr and n0.typ.kind notin {tyProc, tyGenericInst, tyOwned}: result = n0 result.transitionSonsKind(nkCall) for i in 1.. Date: Sat, 26 Apr 2025 17:00:34 -0400 Subject: [PATCH 06/17] adjust test --- tests/exprs/tdots.nim | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/exprs/tdots.nim b/tests/exprs/tdots.nim index 572ec1751070..f6128056e861 100644 --- a/tests/exprs/tdots.nim +++ b/tests/exprs/tdots.nim @@ -2,8 +2,6 @@ discard """ action: run """ -doAssert false # is this test even running?? - #24913 block: type @@ -36,17 +34,17 @@ block: Rule[int](p: sp).spring() -block: - type - Cont[T] = ref RootObj - Rule[T] = object - p: Cont[T] +# cant be in a block +type + Cont[T] = ref RootObj + Rule[T] = object + p: Cont[T] - proc p(x: Rule[int]; y: int): int = 5 +proc p(x: Rule[int]; y: int): int = 5 - proc spring[T](rule: Rule[T]) = - let p = proc (x: T) = - doAssert rule.p(x) == 5 - p(default(T)) +proc spring[T](rule: Rule[T]) = + let p = proc (x: T) = + doAssert rule.p(x) == 5 + p(default(T)) - Rule[int]().spring() +Rule[int]().spring() From 2ed5744d8b9350b8ed30b4edf0278bcb07013655 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sun, 27 Apr 2025 12:28:10 -0400 Subject: [PATCH 07/17] support call operator --- compiler/semcall.nim | 18 +++++++++-- compiler/semexprs.nim | 73 +++++++++++++++++++++++++------------------ 2 files changed, 59 insertions(+), 32 deletions(-) diff --git a/compiler/semcall.nim b/compiler/semcall.nim index e3c6ea851bb0..97f12d0be02a 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -614,11 +614,19 @@ proc resolveOverloads(c: PContext, n, orig: PNode, if c.inGenericContext > 0 and nfExprCall in n.flags: # untyped expression calls end up here, see #24099 return + if efPreferNilResult in flags: + result.state = csEmpty + #result.call = nil + return # xxx adapt/use errorUndeclaredIdentifierHint(c, n, f.ident) localError(c.config, n.info, getMsgDiagnostic(c, flags, n, f)) return elif result.state != csMatch: if nfExprCall in n.flags: + if efPreferNilResult in flags: + result.state = csEmpty + #result.call = nil + return localError(c.config, n.info, "expression '$1' cannot be called" % renderTree(n, {renderNoComments})) else: @@ -629,6 +637,10 @@ proc resolveOverloads(c: PContext, n, orig: PNode, return if alt.state == csMatch and cmpCandidates(result, alt) == 0 and not sameMethodDispatcher(result.calleeSym, alt.calleeSym): + if efPreferNilResult in flags: + result.state = csEmpty + #result.call = nil + return internalAssert c.config, result.state == csMatch #writeMatches(result) #writeMatches(alt) @@ -909,13 +921,15 @@ proc semOverloadedCall(c: PContext, n, nOrig: PNode, if c.inGenericContext > 0 and c.matchedConcept == nil: result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) - elif efExplain notin flags: + elif {efPreferNilResult, efExplain} * flags == {}: + # repeat the overload resolution, # this time enabling all the diagnostic output (this should fail again) result = semOverloadedCall(c, n, nOrig, filter, flags + {efExplain}) elif efNoUndeclared notin flags: result = nil - notFoundError(c, n, errors) + if efPreferNilResult notin flags: + notFoundError(c, n, errors) else: result = nil diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 590cc396bc43..5f92543e6745 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -994,18 +994,18 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, let callee = result[0].sym case callee.kind of skMacro, skTemplate: discard - else: - if callee.kind == skIterator and callee.id == c.p.owner.id and - not isClosureIterator(c.p.owner.typ): + of skIterator: + if callee.id == c.p.owner.id and not isClosureIterator(c.p.owner.typ): localError(c.config, n.info, errRecursiveDependencyIteratorX % callee.name.s) # error correction, prevents endless for loop elimination in transf. # See bug #2051: result[0] = newSymNode(errorSym(c, n)) - elif callee.kind == skIterator: - if efWantIterable in flags: - let typ = newTypeS(tyIterable, c) - rawAddSon(typ, result.typ) - result.typ() = typ + elif efWantIterable in flags: + let typ = newTypeS(tyIterable, c) + rawAddSon(typ, result.typ) + result.typ() = typ + else: + discard proc resolveIndirectCall(c: PContext; n, nOrig: PNode; t: PType): TCandidate = @@ -1094,14 +1094,6 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) return - elif n0.kind == nkDotExpr and n0.typ.kind notin {tyProc, tyGenericInst, tyOwned}: - result = n0 - result.transitionSonsKind(nkCall) - for i in 1.. Date: Sun, 27 Apr 2025 12:31:06 -0400 Subject: [PATCH 08/17] remove some garbage --- compiler/semexprs.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 5f92543e6745..41f461882fa5 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1159,7 +1159,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType if result == nil or result.kind == nkEmpty: var tcall = n.copyTree if n[0].kind == nkDotExpr and n[0].typ.kind notin {tyProc, tyGenericInst, tyOwned}: - tcall = n[0] #semFieldAccess(c, n[0], {efIsDotCall}) + tcall = n[0] tcall.transitionSonsKind(nkCall) for i in 1.. Date: Sun, 27 Apr 2025 15:38:55 -0400 Subject: [PATCH 09/17] patch --- compiler/semexprs.nim | 9 ++++++++- tests/exprs/tdots.nim | 13 +++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 41f461882fa5..72133e32cb47 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1104,11 +1104,11 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType elif isSymChoice(n[0]) and nfDotField notin n.flags: # overloaded generic procs e.g. newSeq[int] can end up here return semDirectOp(c, n, flags, expectedType) - var t: PType = nil if n[0].typ != nil: t = skipTypes(n[0].typ, abstractInst+{tyOwned}-{tyTypeDesc, tyDistinct}) + # think this might not be needed now if t != nil and t.kind == tyTypeDesc and n[0] != nil and n[0].kind == nkBracketExpr and n.len == 1: # we don't overload `[]` on generic typeclasses @@ -1183,6 +1183,8 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType return semObjConstr(c, n, flags, expectedType) else: result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags) + #if result == nil: + # return errorNode(c, n) else: result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efExplain}) return errorNode(c, n) @@ -1190,6 +1192,11 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType # the semExpr() in overloadedCallOpr can even break this condition! # See bug #904 of how to trigger it: return result + if result.typ != nil and result.typ.kind == tyFromExpr and t.kind == tyTypeDesc: + # this is wrong but tyFromExpr doesn't always seem to be a valid result + # anecdotally, this is what the compiler is trying to do but I think + # tyFromExpr needs to be handled elsewhere + return semObjConstr(c, n, flags, expectedType) if result[0].kind == nkSym: result = afterCallActions(c, result, nOrig, flags, expectedType) else: diff --git a/tests/exprs/tdots.nim b/tests/exprs/tdots.nim index f6128056e861..ab3bab28cf9d 100644 --- a/tests/exprs/tdots.nim +++ b/tests/exprs/tdots.nim @@ -34,6 +34,19 @@ block: Rule[int](p: sp).spring() +block: + type + A = object + + proc new(T: type A): ref A = + let c = (ref T)() + c + + proc p[K](rng=A.new()) = + discard new(A) + + p[int]() + # cant be in a block type Cont[T] = ref RootObj From 16625a2a34b33eaf41ff28ab66a9ecd73f26c5a0 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sun, 27 Apr 2025 16:40:11 -0400 Subject: [PATCH 10/17] nil checks - remove dead code --- compiler/semexprs.nim | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 72133e32cb47..677a283c5743 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1107,12 +1107,6 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType var t: PType = nil if n[0].typ != nil: t = skipTypes(n[0].typ, abstractInst+{tyOwned}-{tyTypeDesc, tyDistinct}) - - # think this might not be needed now - if t != nil and t.kind == tyTypeDesc and n[0] != nil and - n[0].kind == nkBracketExpr and n.len == 1: - # we don't overload `[]` on generic typeclasses - return semObjConstr(c, n, flags, expectedType) var nOrig = n.copyTree semOpAux(c, n) @@ -1176,23 +1170,20 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efPreferNilResult}) if result == nil: - if t.kind in {tyFromExpr, tyTypeDesc}: + if t != nil and t.kind in {tyFromExpr, tyTypeDesc}: if n.len == 2: return semConv(c, n, flags) elif n.len == 1: return semObjConstr(c, n, flags, expectedType) else: - result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags) - #if result == nil: - # return errorNode(c, n) + return errorNode(c, n) else: result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efExplain}) - return errorNode(c, n) elif result.kind notin nkCallKinds: # the semExpr() in overloadedCallOpr can even break this condition! # See bug #904 of how to trigger it: return result - if result.typ != nil and result.typ.kind == tyFromExpr and t.kind == tyTypeDesc: + if result.typ != nil and result.typ.kind == tyFromExpr and t != nil and t.kind == tyTypeDesc: # this is wrong but tyFromExpr doesn't always seem to be a valid result # anecdotally, this is what the compiler is trying to do but I think # tyFromExpr needs to be handled elsewhere From 495350f88e607d6c2309cea9cda8ff98076a9ee9 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sun, 27 Apr 2025 17:41:13 -0400 Subject: [PATCH 11/17] nil again --- compiler/semexprs.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 677a283c5743..85b45cf50351 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1175,14 +1175,14 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType return semConv(c, n, flags) elif n.len == 1: return semObjConstr(c, n, flags, expectedType) - else: - return errorNode(c, n) else: result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efExplain}) elif result.kind notin nkCallKinds: # the semExpr() in overloadedCallOpr can even break this condition! # See bug #904 of how to trigger it: return result + if result == nil: + return errorNode(c, n) if result.typ != nil and result.typ.kind == tyFromExpr and t != nil and t.kind == tyTypeDesc: # this is wrong but tyFromExpr doesn't always seem to be a valid result # anecdotally, this is what the compiler is trying to do but I think From 91b03a940fefb37207424e5f60b2fb0ee2bc347a Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Sun, 27 Apr 2025 20:10:39 -0400 Subject: [PATCH 12/17] try this --- compiler/semexprs.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 85b45cf50351..fc8765fbb559 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1167,16 +1167,17 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType tcall[0] = prc nOrig[0] = prc tcall.flags.incl nfExprCall - - result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efPreferNilResult}) + let canspec = t != nil and t.kind in {tyFromExpr, tyTypeDesc} + var fflags = flags + if canspec: + fflags.incl efPreferNilResult + result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, fflags) if result == nil: - if t != nil and t.kind in {tyFromExpr, tyTypeDesc}: + if canspec: if n.len == 2: return semConv(c, n, flags) elif n.len == 1: return semObjConstr(c, n, flags, expectedType) - else: - result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, flags + {efExplain}) elif result.kind notin nkCallKinds: # the semExpr() in overloadedCallOpr can even break this condition! # See bug #904 of how to trigger it: From 4e940b7da8c0c0512e7819bed4eaf9fb4fbf7c01 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Thu, 1 May 2025 03:33:58 -0400 Subject: [PATCH 13/17] use `efNoUndeclared` --- compiler/semcall.nim | 12 ------------ compiler/semexprs.nim | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 97f12d0be02a..10f8e810c6ce 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -614,19 +614,11 @@ proc resolveOverloads(c: PContext, n, orig: PNode, if c.inGenericContext > 0 and nfExprCall in n.flags: # untyped expression calls end up here, see #24099 return - if efPreferNilResult in flags: - result.state = csEmpty - #result.call = nil - return # xxx adapt/use errorUndeclaredIdentifierHint(c, n, f.ident) localError(c.config, n.info, getMsgDiagnostic(c, flags, n, f)) return elif result.state != csMatch: if nfExprCall in n.flags: - if efPreferNilResult in flags: - result.state = csEmpty - #result.call = nil - return localError(c.config, n.info, "expression '$1' cannot be called" % renderTree(n, {renderNoComments})) else: @@ -637,10 +629,6 @@ proc resolveOverloads(c: PContext, n, orig: PNode, return if alt.state == csMatch and cmpCandidates(result, alt) == 0 and not sameMethodDispatcher(result.calleeSym, alt.calleeSym): - if efPreferNilResult in flags: - result.state = csEmpty - #result.call = nil - return internalAssert c.config, result.state == csMatch #writeMatches(result) #writeMatches(alt) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index fc8765fbb559..1a1f3a00fb5a 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1170,7 +1170,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType let canspec = t != nil and t.kind in {tyFromExpr, tyTypeDesc} var fflags = flags if canspec: - fflags.incl efPreferNilResult + fflags.incl efNoUndeclared result = semOverloadedCallAnalyseEffects(c, tcall, nOrig, fflags) if result == nil: if canspec: From dd9b0c5622659035ad1c5b9198b3967312f92178 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Thu, 1 May 2025 03:37:26 -0400 Subject: [PATCH 14/17] come on --- compiler/semcall.nim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 10f8e810c6ce..ac9dabb31d07 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -909,15 +909,14 @@ proc semOverloadedCall(c: PContext, n, nOrig: PNode, if c.inGenericContext > 0 and c.matchedConcept == nil: result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) - elif {efPreferNilResult, efExplain} * flags == {}: + elif efExplain notin flags: # repeat the overload resolution, # this time enabling all the diagnostic output (this should fail again) result = semOverloadedCall(c, n, nOrig, filter, flags + {efExplain}) elif efNoUndeclared notin flags: result = nil - if efPreferNilResult notin flags: - notFoundError(c, n, errors) + notFoundError(c, n, errors) else: result = nil From ffe113037f1b9ad65ab3995810f0ef21fcffbdaa Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Thu, 1 May 2025 03:38:11 -0400 Subject: [PATCH 15/17] whitespace --- compiler/semcall.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/semcall.nim b/compiler/semcall.nim index ac9dabb31d07..e3c6ea851bb0 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -910,7 +910,6 @@ proc semOverloadedCall(c: PContext, n, nOrig: PNode, result = semGenericStmt(c, n) result.typ() = makeTypeFromExpr(c, result.copyTree) elif efExplain notin flags: - # repeat the overload resolution, # this time enabling all the diagnostic output (this should fail again) result = semOverloadedCall(c, n, nOrig, filter, flags + {efExplain}) From 67d5782383df16e408b7bc2ee90dfaf63ed8d296 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Tue, 6 May 2025 11:06:53 -0400 Subject: [PATCH 16/17] helper 1 --- compiler/semexprs.nim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 1a1f3a00fb5a..83e7935aefef 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1075,6 +1075,17 @@ proc afterCallActions(c: PContext; n, orig: PNode, flags: TExprFlags; expectedTy # don't fold calls in concepts and typeof result = evalAtCompileTime(c, result) +proc normalizeMethodCallSyntax(n: PNode): PNode = + # transforms A.b(C) to b(A, C) + # does not check if `b` is a field + result = n[0] + result.transitionSonsKind(nkCall) + for i in 1.. Date: Tue, 6 May 2025 11:27:29 -0400 Subject: [PATCH 17/17] not needed? --- compiler/semexprs.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 83e7935aefef..b1cf1a6cb761 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1084,7 +1084,6 @@ proc normalizeMethodCallSyntax(n: PNode): PNode = let tmp = result[1] result[1] = result[0] result[0] = tmp - result.typ() = nil proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType = nil): PNode = result = nil