Commit f0bd124
committed
Fix missing implementation for identity comparison of structs.
Prior to this commit, trying to compare two structs for
identity equality (`===`/`!==`) would raise an exception
at compile time, because this case was not implemented.
There are still other cases that are not implemented
(such as dealing with the case where one side is a boxed value,
and the other side is an unboxed value).
But those are left to be implemented at a later time.
Particularly, it's expected that we'll soon redesign the way
equality works in Savi (
see https://savi.zulipchat.com/#narrow/stream/294897-general/topic/Element-wise.20Array.20comparison.20fails
) so that the compiler will automatically generate
a default `==` implementation for all types
(which can be overridden by the user). At that time, we could
also generate a `===` implementation that cannot be overridden,
which would allow us to simplify the code being modified
here in this commit, as we could change this call site to
a basic method call (for the `===` method) after type comparison,
rather than coding the field-wise comparison as LLVM IR as
we did here, and sidestepping issues with boxed/unboxed things,
as the typical virtual call mechanism will take care of
resolving the appropriate unboxed values into method args.1 parent 507da40 commit f0bd124
File tree
2 files changed
+81
-9
lines changed- spec/language/semantics
- src/savi/compiler
2 files changed
+81
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2182 | 2182 | | |
2183 | 2183 | | |
2184 | 2184 | | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
2190 | 2204 | | |
2191 | 2205 | | |
2192 | 2206 | | |
| |||
2215 | 2229 | | |
2216 | 2230 | | |
2217 | 2231 | | |
2218 | | - | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
2219 | 2285 | | |
2220 | 2286 | | |
2221 | 2287 | | |
| |||
2232 | 2298 | | |
2233 | 2299 | | |
2234 | 2300 | | |
2235 | | - | |
| 2301 | + | |
2236 | 2302 | | |
2237 | 2303 | | |
2238 | 2304 | | |
| |||
2626 | 2692 | | |
2627 | 2693 | | |
2628 | 2694 | | |
2629 | | - | |
2630 | | - | |
| 2695 | + | |
| 2696 | + | |
2631 | 2697 | | |
2632 | 2698 | | |
2633 | 2699 | | |
| |||
0 commit comments