Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2565,7 +2565,6 @@ function abstract_eval_setglobalonce!(interp::AbstractInterpreter, sv::AbsIntSta
end
end


function abstract_eval_replaceglobal!(interp::AbstractInterpreter, sv::AbsIntState, saw_latestworld::Bool, argtypes::Vector{Any})
if length(argtypes) in (5, 6, 7)
(M, s, x, v) = argtypes[2], argtypes[3], argtypes[4], argtypes[5]
Expand Down Expand Up @@ -3670,7 +3669,7 @@ end

function global_assignment_rt_exct(interp::AbstractInterpreter, sv::AbsIntState, saw_latestworld::Bool, g::GlobalRef, @nospecialize(newty))
if saw_latestworld
return Pair{Any,Any}(newty, Union{ErrorException, TypeError})
return Pair{Any,Any}(newty, ErrorException)
end
(valid_worlds, ret) = scan_partitions((interp, _, partition)->global_assignment_binding_rt_exct(interp, partition, newty), interp, g, sv.world)
update_valid_age!(sv, valid_worlds)
Expand All @@ -3687,10 +3686,10 @@ function global_assignment_binding_rt_exct(interp::AbstractInterpreter, partitio
ty = kind == PARTITION_KIND_DECLARED ? Any : partition_restriction(partition)
wnewty = widenconst(newty)
if !hasintersect(wnewty, ty)
return Pair{Any,Any}(Bottom, TypeError)
return Pair{Any,Any}(Bottom, ErrorException)
elseif !(wnewty <: ty)
retty = tmeet(typeinf_lattice(interp), newty, ty)
return Pair{Any,Any}(retty, TypeError)
return Pair{Any,Any}(retty, ErrorException)
end
return Pair{Any,Any}(newty, Bottom)
end
Expand Down
5 changes: 5 additions & 0 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6408,4 +6408,9 @@ let src = code_typed1((Base.RefValue{String}, String)) do x, val
@test isa(retval, Core.SSAValue)
end

global invalid_setglobal!_exct_modeling::Int
@test Base.infer_exception_type((Float64,)) do x
setglobal!(@__MODULE__, :invalid_setglobal!_exct_modeling, x)
end == ErrorException

end # module inference