Optional<Float32> weird behavior

I noticed that some time ago the ImGui widgets had their types slightly changed. Something like the Min and Max for a Slider is now Optional<Float32> and not Float32 as before.

There is some weirdness when connecting a Float32 input to a Optional<Float32>:

optiona-float32

What is going on here? Why isn’t Float32 directly compatible with Optional<Float32>, but if we put an IOBox in between it works just fine.

This is in 7.0-0455. Patch is How to Run Benchmarks help patch.

ps: Please make the red color of links with errors more visible in dark mode. It is almost invisible at the moment! You can check recommended contrast ratios here: Color Contrast Checker - Coolors. 1.11 is almost as low as it goes (values go from 1 to 21, where 1 is the same color)

2 Likes

Clearly the type inference is not the smartest there. Upcoming preview should handle this case better.

Regarding the coloring: indeed, issue was that two styles got combined (error and unused) which in turn led to that very dark red. In upcoming the system will no longer apply the unused style (transparent) if error style is already in place. Thanks for pointing it out.

2 Likes