cubos icon indicating copy to clipboard operation
cubos copied to clipboard

Ensure reflectable types with `FieldsTrait` expose all of their fields

Open RiscadoA opened this issue 2 years ago • 2 comments

Problem

It hasn't happened yet but it seems that someone adding a new field to a reflectable type and forgetting to add it to the trait will be a common problem. It will probably will be hard to debug, at least in the near future.

In a more distant future, it probably won't be that bad for game devs using our engine, as they would probably notice quickly that the new field isn't saved to scene files and won't appear on the editor.

Solution

We could have a CI action to check that this isn't violated, or extend clang-tidy to do so.

RiscadoA avatar Oct 01 '23 13:10 RiscadoA

Maybe also relevant for EnumTrait (#579)

roby2014 avatar Nov 18 '23 06:11 roby2014

Maybe also relevant for EnumTrait (#579)

We previously discussed a partial solution to this problem which doesn't cover the EnumTrait scenario, which was checking if the size of the type we're reflecting actually makes sense considering the fields we're reflecting. In retrospective, that isn't a good approach as we possibly want to avoid reflecting some fields anyway. But yeah, that solution wasn't perfect anyway.

RiscadoA avatar Nov 18 '23 06:11 RiscadoA