@@ -42,7 +42,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
42
42
arginfo:: ArgInfo , si:: StmtInfo , @nospecialize (atype),
43
43
sv:: AbsIntState , max_methods:: Int )
44
44
𝕃ₚ, 𝕃ᵢ = ipo_lattice (interp), typeinf_lattice (interp)
45
- ⊑ ₚ, ⊔ ₚ, ⊔ ᵢ = partialorder (𝕃ₚ), join (𝕃ₚ), join (𝕃ᵢ)
45
+ ⊑ ₚ, ⋤ ₚ, ⊔ ₚ, ⊔ ᵢ = partialorder (𝕃ₚ), strictneqpartialorder (𝕃ₚ), join (𝕃ₚ), join (𝕃ᵢ)
46
46
argtypes = arginfo. argtypes
47
47
matches = find_method_matches (interp, argtypes, atype; max_methods)
48
48
if isa (matches, FailedMethodMatch)
@@ -97,7 +97,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
97
97
else
98
98
add_remark! (interp, sv, " [constprop] Discarded because the result was wider than inference" )
99
99
end
100
- if ! ( exct ⊑ ₚ const_call_result . exct)
100
+ if const_call_result . exct ⋤ exct
101
101
exct = const_call_result. exct
102
102
(; const_result, edge) = const_call_result
103
103
else
@@ -154,7 +154,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
154
154
end
155
155
# Treat the exception type separately. Currently, constprop often cannot determine the exception type
156
156
# because consistent-cy does not apply to exceptions.
157
- if ! (this_exct ⊑ ₚ const_call_result. exct)
157
+ if const_call_result. exct ⋤ this_exct
158
158
this_exct = const_call_result. exct
159
159
(; const_result, edge) = const_call_result
160
160
else
@@ -2342,10 +2342,10 @@ function abstract_call_opaque_closure(interp::AbstractInterpreter,
2342
2342
hasintersect (sig, ocsig) || return CallMeta (Union{}, Union{MethodError,TypeError}, EFFECTS_THROWS, NoCallInfo ())
2343
2343
ocmethod = closure. source:: Method
2344
2344
result = abstract_call_method (interp, ocmethod, sig, Core. svec (), false , si, sv)
2345
- (; rt, edge, effects, volatile_inf_result) = result
2345
+ (; rt, exct, edge, effects, volatile_inf_result) = result
2346
2346
match = MethodMatch (sig, Core. svec (), ocmethod, sig <: ocsig )
2347
2347
𝕃ₚ = ipo_lattice (interp)
2348
- ⊑ ₚ = ⊑ (𝕃ₚ)
2348
+ ⊑ ₚ, ⋤ ₚ = partialorder (𝕃ₚ), strictneqpartialorder (𝕃ₚ)
2349
2349
const_result = volatile_inf_result
2350
2350
if ! result. edgecycle
2351
2351
const_call_result = abstract_call_method_with_const_args (interp, result,
@@ -2354,20 +2354,23 @@ function abstract_call_opaque_closure(interp::AbstractInterpreter,
2354
2354
if const_call_result. rt ⊑ ₚ rt
2355
2355
(; rt, effects, const_result, edge) = const_call_result
2356
2356
end
2357
+ if const_call_result. exct ⋤ ₚ exct
2358
+ (; exct, const_result, edge) = const_call_result
2359
+ end
2357
2360
end
2358
2361
end
2359
2362
if check # analyze implicit type asserts on argument and return type
2360
- ftt = closure. typ
2361
- (aty, rty) = (unwrap_unionall (ftt):: DataType ). parameters
2362
- rty = rewrap_unionall (rty isa TypeVar ? rty. lb : rty, ftt)
2363
- if ! (rt ⊑ ₚ rty && tuple_tfunc (𝕃ₚ, arginfo. argtypes[2 : end ]) ⊑ ₚ rewrap_unionall (aty, ftt))
2363
+ rty = (unwrap_unionall (tt):: DataType ). parameters[2 ]
2364
+ rty = rewrap_unionall (rty isa TypeVar ? rty. ub : rty, tt)
2365
+ if ! (rt ⊑ ₚ rty && sig ⊑ ₚ ocsig)
2364
2366
effects = Effects (effects; nothrow= false )
2367
+ exct = tmerge (𝕃ₚ, exct, TypeError)
2365
2368
end
2366
2369
end
2367
2370
rt = from_interprocedural! (interp, rt, sv, arginfo, match. spec_types)
2368
2371
info = OpaqueClosureCallInfo (match, const_result)
2369
2372
edge != = nothing && add_backedge! (sv, edge)
2370
- return CallMeta (rt, Any , effects, info)
2373
+ return CallMeta (rt, exct , effects, info)
2371
2374
end
2372
2375
2373
2376
function most_general_argtypes (closure:: PartialOpaque )
0 commit comments