Skip to content

possible type constraint propagation from !(a && b) pattern #43130

@aviatesk

Description

@aviatesk

In the code snippet below, ideally we want to propagate uw::DataType information to #7:

julia> code_typed((Any,Type); optimize=false) do uw, ti
           (uw isa DataType && ti <: uw.name.wrapper) || return nothing
           uw
       end
1-element Vector{Any}:
 CodeInfo(
1%1 = (uw isa Main.DataType)::Bool
└──      goto #3 if not %1
2%3 = Base.getproperty(uw::DataType, :name)::Core.TypeName%4 = Base.getproperty(%3, :wrapper)::Type
│        (@_4 = ti <: %4)::Bool
└──      goto #4
3 ─      (@_4 = false)::Core.Const(false)
4%8 = @_4::Bool
└──      goto #6 if not %8
5 ─      goto #7
6return Main.nothing
7return uw
) => Any

I feel like this can be fixed by a lowering improvement as we did for #39611?

/cc @simeonschaub @vtjnash

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions