File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 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) =
21532153proc bindTypeHook (c: PContext ; s: PSym ; n: PNode ; op: TTypeAttachedOp ) =
21542154 let t = s.typ
21552155 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}
21562160 let cond = case op
21572161 of attachedWasMoved:
21582162 t.len == 2 and t.returnType == nil and t.firstParamType.kind == tyVar
21592163 of attachedTrace:
21602164 t.len == 3 and t.returnType == nil and t.firstParamType.kind == tyVar and t[2 ].kind == tyPointer
21612165 of attachedDestructor:
2162- if c.config.selectedGC in {gcArc, gcAtomicArc, gcOrc} :
2166+ if notRefc :
21632167 t.len == 2 and t.returnType == nil
21642168 else :
21652169 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) =
21922196 localError (c.config, n.info, errGenerated,
21932197 " signature for '=trace' must be proc[T: object](x: var T; env: pointer)" )
21942198 of attachedDestructor:
2195- if c.config.selectedGC in {gcArc, gcAtomicArc, gcOrc} :
2199+ if notRefc :
21962200 localError (c.config, n.info, errGenerated,
21972201 " signature for '=destroy' must be proc[T: object](x: var T) or proc[T: object](x: T)" )
21982202 else :
You can’t perform that action at this time.
0 commit comments