clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.12k stars 100 forks source link

Fix unsoundness in `AlgebraicValue::type_of` by making it partial #1189

Closed Centril closed 1 week ago

Centril commented 2 weeks ago

Description of Changes

First we reduce the number of .type_of() calls to one. Then we make the method sound by making it partial without an answer in e.g., the case of sums. Also cleans up the bsatn roundtrip test.

Fixes https://github.com/clockworklabs/SpacetimeDB/issues/104.

API and ABI breaking changes

None

Expected complexity level and risk

1

Centril commented 1 week ago

I'm curious, what is this API currently used for?

The only remaining use is in Header::project as seen in the diff.