Skip to content

Commit

Permalink
simplify output file management: always append; change output format
Browse files Browse the repository at this point in the history
the format is now that of method defn
  • Loading branch information
ulysses4ever committed Dec 11, 2023
1 parent 095a9f1 commit 2ff1861
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/StabilityCheck.jl
Original file line number Diff line number Diff line change
@@ -126,8 +126,7 @@ is_stable_method(m::Method, scfg :: SearchCfg = default_scfg) :: StCheck = begin

# trace TS checks and store to a file
if scfg.trace_checks
mkpath("checks")
fchecks = open("checks/$(m.name)", "w")
fchecks = open("checks", "a")
end

# preemptively load types DB if available: we may need to sample
@@ -150,7 +149,7 @@ is_stable_method(m::Method, scfg :: SearchCfg = default_scfg) :: StCheck = begin
@debug "is_stable_method: check against signature (2a)"
try
scfg.trace_checks &&
println(fchecks, sig_types)
print_check(fchecks, m, sig_types)
if is_stable_call(func, sig_types)
scfg.trace_checks &&
close(fchecks)
@@ -200,7 +199,7 @@ is_stable_method(m::Method, scfg :: SearchCfg = default_scfg) :: StCheck = begin
# the actual stability check
try
scfg.trace_checks &&
println(fchecks, ts)
print_check(fchecks, m, ts)
if ! is_stable_call(func, ts)
push!(unst, ts)
if scfg.failfast
9 changes: 9 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -134,3 +134,12 @@ is_module_nested(m::Module, outer::Module) :: Bool = begin
m = parentmodule(m)
end
end

# Print type stability check in a form of pseudo-method declaration
print_check(io, m::Method, @nospecialize(types)) = begin
print(io, "function $(m.name)(")
for t in types
print(io, "::$t")
end
println(io, ")")
end

0 comments on commit 2ff1861

Please sign in to comment.