From c31121ec3bbf742639e93f96460487edb7bcff98 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Sat, 23 May 2026 18:43:07 +0800 Subject: [PATCH] refactor: simplify type comparison logic by removing unnecessary type skips --- compiler/ccgexprs.nim | 4 +--- compiler/types.nim | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 62302146f1..5b0b793932 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -974,9 +974,7 @@ proc cow(p: BProc; n: PNode) {.inline.} = if n.kind == nkHiddenAddr: cowBracket(p, n[0]) template ignoreConv(e: PNode): bool = - let destType = e.typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink}) - let srcType = e[1].typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink}) - sameBackendTypePickyAliases(destType, srcType) + sameBackendTypePickyAliases(e.typ, e[1].typ) proc genAddr(p: BProc, e: PNode, d: var TLoc) = # careful 'addr(myptrToArray)' needs to get the ampersand: diff --git a/compiler/types.nim b/compiler/types.nim index de24471e7d..0b1388da0a 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -1070,6 +1070,8 @@ proc sameBackendTypeIgnoreRange*(x, y: PType): bool = result = sameTypeAux(x, y, c) proc sameBackendTypePickyAliases*(x, y: PType): bool = + let x = x.skipTypes(abstractVar) + let y = y.skipTypes(abstractVar) var c = initSameTypeClosure() c.flags.incl {IgnoreTupleFields, IgnoreRangeShallow, PickyCAliases, PickyBackendAliases} c.cmp = dcEqIgnoreDistinct