@@ -760,7 +760,8 @@ jobs:
760760 dotnet run --project frontend/roslyn/OwnSharp.Extractor -- \
761761 frontend/roslyn/samples/FlowLocalsSample.cs \
762762 frontend/roslyn/samples/MemoryOwnerEscapeSample.cs \
763- frontend/roslyn/samples/FactoryLeakSample.cs --flow-locals -o "$RUNNER_TEMP/flow.json"
763+ frontend/roslyn/samples/FactoryLeakSample.cs \
764+ frontend/roslyn/samples/OverloadSigSample.cs --flow-locals -o "$RUNNER_TEMP/flow.json"
764765 out=$(python -m ownlang ownir "$RUNNER_TEMP/flow.json" || true)
765766 echo "$out"
766767 echo "$out" | grep -q "OWN002" || { echo "FAIL: expected OWN002 (use-after-dispose)"; exit 1; }
@@ -949,6 +950,39 @@ jobs:
949950 for ok in factoryOk made; do
950951 if echo "$out" | grep -q "'$ok'"; then echo "FAIL: D5.2 silent case '$ok' was reported"; exit 1; fi
951952 done
953+ # Interprocedural stage 2 (spec/OwnIR.md §5.1): per-overload signature keys.
954+ # SigOverloads.Open is overloaded — the (string) overload is a fresh factory,
955+ # the (FileStream,bool) one returns its parameter — so the name-merged returns
956+ # DISAGREE (no fresh claim). The `sig` stamped on both the functions[] records
957+ # and the call op resolves the fresh overload's OWN summary, so the dropped
958+ # stream in Drop surfaces as OWN001 at the call — the recall the merge lost.
959+ # Structural check (CodeRabbit): pin BOTH sides of the edge exactly — the two
960+ # overload records' sigs AND the Drop call op's callee/sig/result — so a
961+ # missing or unmatched CALL-side sig fails here by itself, not only via the
962+ # downstream finding.
963+ python3 - "$RUNNER_TEMP/flow.json" <<'PY'
964+ import json, sys
965+ facts = json.load(open(sys.argv[1]))
966+ fns = facts.get("functions", [])
967+ sigs = sorted(str(f.get("sig")) for f in fns
968+ if f.get("name") == "SigOverloads.Open")
969+ assert sigs == ["System.IO.FileStream,System.Boolean", "System.String"], \
970+ f"overload record sigs wrong: {sigs}"
971+ calls = [op for f in fns if f.get("name") == "SigOverloads.Drop"
972+ for op in f.get("body", []) if op.get("op") == "call"]
973+ assert any(c.get("callee") == "SigOverloads.Open"
974+ and c.get("sig") == "System.String"
975+ and c.get("result") == "dropped" for c in calls), \
976+ f"Drop call op missing the (string) overload sig: {calls}"
977+ print("OK: stage-2 sig stamped on both sides of the Drop edge")
978+ PY
979+ echo "$out" | grep -qE "OverloadSigSample\.cs:[0-9]+:.*\[OWN001\].*'dropped' is never disposed" \
980+ || { echo "FAIL: expected the sig-resolved fresh-overload leak (OWN001 on 'dropped')"; exit 1; }
981+ # the factory itself (transfers out via return), the non-fresh overload's
982+ # balanced probe, and the fresh local it returns all stay silent.
983+ for ok in opened probe; do
984+ if echo "$out" | grep -q "'$ok'"; then echo "FAIL: stage-2 silent case '$ok' was reported"; exit 1; fi
985+ done
952986 echo "OK: flow-sensitive OWN001/002/003 on real C# (path-sensitive, loops via while/foreach/for, try/finally sequential, never-vs-every-path wording, dispose-optional exempt, beyond flat)"
953987 - name : Gallery C#-native bad/ok pairs (examples/gallery/cs/)
954988 run : |
0 commit comments