https://github.com/JuliaLang/julia
Revision bbe91dbfaa27dae35cce2b27ef68cb12ff6a1aba authored by Shuhei Kadowaki on 11 October 2021, 05:47:03 UTC, committed by KristofferC on 08 November 2021, 09:15:05 UTC
During working on the incoming lattice overhaul, I found it's quite
confusing that `TypeVar` and `Vararg` can appear in the same context
as valid `Type` objects as well as extended lattice elements.
Since it usually needs special cases to operate on `TypeVar` and `Vararg`
(e.g. they can not be used in subtyping as an obvious example), I believe
it would be great avoid bugs and catch logic errors in the future development
if we separate contexts where they can appear from ones where `Type`
objects and extended lattice elements are expected.

So this commit:
- tries to separate their context, e.g. now `TypeVar` and `Vararg` should
  not be used in `_limit_type_size`, which is supposed to return `Type`,
  but they should be handled its helper function `__limit_type_size`
- makes sure `tfunc`s don't return `TypeVar`s and `TypeVar` never spills
  into the abstract state
- makes sure `widenconst` are not called on `TypeVar` and `Vararg`,
  and now `widenconst` is ensured to return `Type` always
- and does other general refactors

(cherry picked from commit d60f92cd3a92cd12cae55893e55e6d9e14b0052e)
1 parent 9723f82
History
Tip revision: bbe91dbfaa27dae35cce2b27ef68cb12ff6a1aba authored by Shuhei Kadowaki on 11 October 2021, 05:47:03 UTC
inference: improve `TypeVar`/`Vararg` handling
Tip revision: bbe91db
File Mode Size
.buildkite
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.clang-format -rw-r--r-- 3.3 KB
.codecov.yml -rw-r--r-- 52 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 425 bytes
.mailmap -rw-r--r-- 11.0 KB
CITATION.bib -rw-r--r-- 513 bytes
CONTRIBUTING.md -rw-r--r-- 19.3 KB
HISTORY.md -rw-r--r-- 313.4 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 49.0 KB
Makefile -rw-r--r-- 25.8 KB
NEWS.md -rw-r--r-- 20.3 KB
README.md -rw-r--r-- 7.5 KB
THIRDPARTY.md -rw-r--r-- 3.7 KB
VERSION -rw-r--r-- 10 bytes
sysimage.mk -rw-r--r-- 4.0 KB

README.md

back to top