Skip to content

Commit

Permalink
disallow stolen ref in return values
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Dec 2, 2024
1 parent 647e71c commit 37137fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Tools/refcounts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,11 @@ def check(view: FileView) -> None:
rparam = sig.rparam
if not rparam.ctype:
w.block(sig, "missing return value type")
if rparam.effect is RefEffect.UNKNOWN:
w.block(sig, "unknown return value type")
match rparam.effect:
case RefEffect.UNKNOWN:
w.block(sig, "unknown return value type")
case RefEffect.STEAL:
w.block(sig, "stolen reference on return value")
# check the parameters
for param in sig.params.values(): # type: Param
ctype, effect = param.ctype, param.effect
Expand Down

0 comments on commit 37137fa

Please sign in to comment.