Commit 4a38e79
authored
Fix some vararg-related subtyping issues (#31698)
* Fix jl_obvious_subtype with INT vararg constraint
* Fix a vararg-related non-transitivity in subtyping
* Fix another vararg subtype issue
* Take advantage of their being at most one UnionAll wrapped around a Vararg
Upon construction, we normalize `Vararg{T, N} where {T,N}` to `Vararg{T where T, N} where N`,
thus there can be at most one UnionAll wrapper around a Vararg. In subtyping we were already
assuming that there can be at most two such wrappers, so simply adjust that and add an
appropriate assertion to make sure we catch any cases where this ever goes wrong.
* Rewrite subtype_tuple to fix extra cases
* Put back the case for naked varargs
* Update test/subtype.jl
Co-Authored-By: Keno <keno@alumni.harvard.edu>
* Add test for #31805
* Fix style review comments
* Rename variable
* In person review changes
* Fix bug
* Handle integer bounds on left arguments in the environment
In subtyping proper, variables introduced on the left (i.e. forall
variables) don't have any equality constraints, because we have no
syntax for creating them. However, intersection does sometimes create
such environments, so we need to handle it in subtyping.1 parent b6f10cb commit 4a38e79
File tree
5 files changed
+410
-141
lines changed- base/compiler
- src
- test
5 files changed
+410
-141
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
1085 | 1090 | | |
1086 | 1091 | | |
1087 | 1092 | | |
1088 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
1089 | 1098 | | |
1090 | 1099 | | |
1091 | 1100 | | |
| |||
1138 | 1147 | | |
1139 | 1148 | | |
1140 | 1149 | | |
| 1150 | + | |
1141 | 1151 | | |
1142 | 1152 | | |
1143 | 1153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1281 | 1289 | | |
1282 | 1290 | | |
1283 | 1291 | | |
| |||
0 commit comments