Skip to content

Lower chained inequalities in an extendable way #39104

@dpsanders

Description

@dpsanders

The following lowering makes it impossible to extend 3 <= x <= 4 for user-defined types, e.g. in ModelingToolkit.jl:

julia> Meta.@lower 3 <= x <= 4
:($(Expr(:thunk, CodeInfo(
    @ none within `top-level scope'
1 ─ %1 = 3 <= x
└──      goto #3 if not %1
2 ─ %3 = x <= 4
└──      return %3
3 ─      return false
))))

Could it be lowered to just 3 <=x && x <= 4 or similar?

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions