Closed mrousavy closed 3 days ago
Previously, we only tested a string enum (discriminating union):
type Powertrain = 'gas' | 'electric'
Now, we also test an "old" enum, aka an enum backed by a number:
enum Powertrain { GAS, ELECTRIC }
This is a slightly different implementation on the native side, since we now use the number as a value of truth.
On iOS, for some reason this breaks when using std::optional<Enum>.
std::optional<Enum>
This code breaks:
self.__implementation.optionalOldEnum = newValue.value
This code works:
self.__implementation.optionalOldEnum = newValue.has_value() ? newValue.pointee : nil
So this PR fixes this. And adds a test.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Previously, we only tested a string enum (discriminating union):
Now, we also test an "old" enum, aka an enum backed by a number:
This is a slightly different implementation on the native side, since we now use the number as a value of truth.
On iOS, for some reason this breaks when using
std::optional<Enum>
.This code breaks:
This code works:
So this PR fixes this. And adds a test.