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

Coercion and type fixes #1256

Merged
merged 4 commits into from
Aug 18, 2022
Merged

Coercion and type fixes #1256

merged 4 commits into from
Aug 18, 2022

Conversation

rsmmr
Copy link
Member

@rsmmr rsmmr commented Aug 10, 2022

This ended up fixing three issues that were all related, one per commit.

hilti/toolchain/src/ast/types/struct.cc Show resolved Hide resolved
hilti/toolchain/src/ast/types/struct.cc Outdated Show resolved Hide resolved
hilti/toolchain/include/ast/types/struct.h Outdated Show resolved Hide resolved
hilti/runtime/include/types/address.h Outdated Show resolved Hide resolved
hilti/runtime/include/types/address.h Show resolved Hide resolved
hilti/runtime/include/types/port.h Outdated Show resolved Hide resolved
hilti/toolchain/include/ast/types/network.h Show resolved Hide resolved
hilti/toolchain/include/ast/types/tuple.h Show resolved Hide resolved
tests/spicy/types/map/types.spicy Outdated Show resolved Hide resolved
hilti/toolchain/include/ast/ctors/struct.h Outdated Show resolved Hide resolved
rsmmr added 3 commits August 18, 2022 10:28
Struct types instantiated through a constructor expression could end
up not being fully set up, such as missing a type ID. This wouldn't
occur in cases where the value got coerced before further use, but it
could happen when the type was used directly without coercion.

This easiest fix was to always force coercion for expressions of
anonymous struct types; that also generally unifies how they handled.
We achieve this by changing equality for anonymous struct types to
compare successfully only against themselves, independent of the
fields matching.

Closes #1238.
This also adds comparison operators for a few types that are natural
to use in maps, but didn't support it so far. In future, we could
implement sortability for further types if needed.

Closes #1233.
The struct type's ID could end up not making it across the
Spicy-to-HILTI boundary.

Closes #1234.
@rsmmr rsmmr force-pushed the topic/robin/gh-1238-struct-ctor-fix branch 2 times, most recently from bf6e16f to 1c702bb Compare August 18, 2022 09:44
@rsmmr rsmmr force-pushed the topic/robin/gh-1238-struct-ctor-fix branch from 1c702bb to 49a09e2 Compare August 18, 2022 10:35
@rsmmr rsmmr requested a review from bbannier August 18, 2022 10:35
@rsmmr rsmmr merged commit 15400d9 into main Aug 18, 2022
@rsmmr rsmmr deleted the topic/robin/gh-1238-struct-ctor-fix branch August 18, 2022 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants