Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
warn on empty OptionSet static constants #27089
This adds a warning when declaring a static 'none' property for an OptionSet-conforming type. e.g.:
This is my first PR for the compiler and it feels like I'm going about adding this warning the wrong way. There's a huge pyramid of ifs and for loops. At the bare minimum I think I should refactor this out into a function. Although I feel like there's a much simpler way to do this. Currently 5 tests are failing. Any pointers would be greatly appreciated. Thank you!
Welcome to the compiler! Your logic here is sound, but I think it would be easier to do this the other way around: check when declaring a constant if the current type is an OptionSet, rather than checking for all zero-value constants when handling the OptionSet conformance. @brentdax, did you have an implementation strategy in mind when you marked it as a Starter Bug?