Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typeintersect bug reported in #36443 #46446

Merged
merged 9 commits into from
Sep 2, 2022
Merged

Commits on Sep 1, 2022

  1. Avoid setting offset when we intersect Vararg's eltype.

    `var->offset` is used to recode the length difference of 2 `Vararg`s.
    But `Vararg`'s length might also be used in the type field, e.g. `Tuple{Vararg{Val{N}, N}} where {N}`, where
    we should ignore `offset` when we intersect `Val{N}`.
    
    This commit move the offset setting/erasing into `intersect_varargs`.
    N5N3 committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    01a4a30 View commit details
    Browse the repository at this point in the history
  2. Skip subtype check if intersect_invariant calls set_vat_to_const.

    Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com>
    N5N3 and vtjnash committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    e6d2624 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f29a013 View commit details
    Browse the repository at this point in the history
  4. Always return the shorter Vararg length.

    The type `var` might be switched during intersection. Thus previous result looks order dependent.
    
    When we intersect 2 `Vararg`s' length, we should always return the shorter one.
    As we has consumed the extra elements in `intersect_tuple`.
    
    Also fix JuliaLang#37257
    
    Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com>
    N5N3 and vtjnash committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    38829a0 View commit details
    Browse the repository at this point in the history
  5. Avoid set var's bounds if offset != 0

    if `offset != 0`, then these 2 var should have different value, thus it's invalid to set bounds.
    N5N3 committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    b7f47d5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a6a5f00 View commit details
    Browse the repository at this point in the history
  7. Make bound_var_below return NULL if the input typevar is not valid.

    If offset > 0, the correct result is `var - offset` if expressible.
    
    So an unbounded typevar should not be returned in this case as it might be a diagonal var.
    
    Since the result could be improved if  `N` get fixed, set `intvalued` to 2 as a re-intersection hint.
    N5N3 committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    1268582 View commit details
    Browse the repository at this point in the history
  8. Avoid set var's lb if intersect return a Vararg with free length. (Nu…

    …ll or a local type var)
    
    But `check_unsat_bound` should not be skipped.
    
    Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com>
    N5N3 and vtjnash committed Sep 1, 2022
    Configuration menu
    Copy the full SHA
    2abedf6 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4654cfa View commit details
    Browse the repository at this point in the history