Skip to content

Commit

Permalink
tweaks for inter-procedural constraint back-prop'
Browse files Browse the repository at this point in the history
note that the changes for `isnothing` and `ismissing` aren't necessary,
but they reduce the number of method definitions for good reason;
the less the number of methods they have, the better we can
back-propagate type constraints, because even after a package defines
their own new methods for them we can keep to use our `InterConditional`
logic as far as far as the number of methods is
[≤3](https://github.com/JuliaLang/julia/blob/5c6e21edbfd8f0c7d16ea01c91d1c75c30d4eaa1/base/compiler/types.jl#L119)
  • Loading branch information
aviatesk authored and antoine-levitt committed May 9, 2021
1 parent 525b863 commit f47e725
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,7 @@ const missing = Missing()
Indicate whether `x` is [`missing`](@ref).
"""
ismissing(::Any) = false
ismissing(::Missing) = true
ismissing(x) = x === missing

function popfirst! end

Expand Down
2 changes: 1 addition & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ function operator_associativity(s::Symbol)
end

is_expr(@nospecialize(ex), head::Symbol) = isa(ex, Expr) && (ex.head === head)
is_expr(@nospecialize(ex), head::Symbol, n::Int) = is_expr(ex, head) && length((ex::Expr).args) == n
is_expr(@nospecialize(ex), head::Symbol, n::Int) = is_expr(ex, head) && length(ex.args) == n

is_quoted(ex) = false
is_quoted(ex::QuoteNode) = true
Expand Down
3 changes: 1 addition & 2 deletions base/some.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ Return `true` if `x === nothing`, and return `false` if not.
!!! compat "Julia 1.1"
This function requires at least Julia 1.1.
"""
isnothing(::Any) = false
isnothing(::Nothing) = true
isnothing(x) = x === nothing


"""
Expand Down

0 comments on commit f47e725

Please sign in to comment.