forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
juliatypes.jl: fix and clean up code for Vars
Before we handled ∃R,S.A{R,S} > ∃T.A{T,T} as a kind of special case, and the code had an unappealing asymmetry. However, it is actually not true if R and S both have equal lower and upper bounds (U<:R<:U && U<:S<:U). It turns out that the reason a right-side Var cannot "usually" equal two different left-side Vars is that after being set equal to the first Var, the second Var is not within its bounds (except in the special case of U<:S<:U). Fixing this also fixes other uses of bounded variables. In the improved algorithm, there are separate paths for covariant and contravariant contexts that are entirely symmetric. For invariant context (which we expose instead of contravariant), both paths run. The new code also combines issub(Ty,Var) and issub(Var,Var). issub(Var,Ty) now has more symmetry with those cases and could be combined.
- Loading branch information
1 parent
445c516
commit 8752500
Showing
1 changed file
with
133 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters