File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2153,13 +2153,17 @@ proc bindDupHook(c: PContext; s: PSym; n: PNode; op: TTypeAttachedOp) =
2153
2153
proc bindTypeHook (c: PContext ; s: PSym ; n: PNode ; op: TTypeAttachedOp ) =
2154
2154
let t = s.typ
2155
2155
var noError = false
2156
+ template notRefc : bool =
2157
+ # fixes refc with non-var destructor; cancel warnings (#23156)
2158
+ c.config.backend == backendJs or
2159
+ c.config.selectedGC in {gcArc, gcAtomicArc, gcOrc}
2156
2160
let cond = case op
2157
2161
of attachedWasMoved:
2158
2162
t.len == 2 and t.returnType == nil and t.firstParamType.kind == tyVar
2159
2163
of attachedTrace:
2160
2164
t.len == 3 and t.returnType == nil and t.firstParamType.kind == tyVar and t[2 ].kind == tyPointer
2161
2165
of attachedDestructor:
2162
- if c.config.selectedGC in {gcArc, gcAtomicArc, gcOrc} :
2166
+ if notRefc :
2163
2167
t.len == 2 and t.returnType == nil
2164
2168
else :
2165
2169
t.len == 2 and t.returnType == nil and t.firstParamType.kind == tyVar
@@ -2192,7 +2196,7 @@ proc bindTypeHook(c: PContext; s: PSym; n: PNode; op: TTypeAttachedOp) =
2192
2196
localError (c.config, n.info, errGenerated,
2193
2197
" signature for '=trace' must be proc[T: object](x: var T; env: pointer)" )
2194
2198
of attachedDestructor:
2195
- if c.config.selectedGC in {gcArc, gcAtomicArc, gcOrc} :
2199
+ if notRefc :
2196
2200
localError (c.config, n.info, errGenerated,
2197
2201
" signature for '=destroy' must be proc[T: object](x: var T) or proc[T: object](x: T)" )
2198
2202
else :
You can’t perform that action at this time.
0 commit comments