ScalaPB icon indicating copy to clipboard operation
ScalaPB copied to clipboard

Add the `asRecognized` to parent trait GeneratedEnum

Open sideeffffect opened this issue 4 years ago • 5 comments

and document the method in documentation

sideeffffect avatar Apr 15 '20 21:04 sideeffffect

Hi @thesamet ! Have you had the change to look at this PR yet? :slightly_smiling_face:

sideeffffect avatar May 05 '20 09:05 sideeffffect

Sorry for the delay. I am not comfortable with this proposal since inferred type for users' enum vals is going to become Recognized rather than EnumName.

thesamet avatar May 05 '20 14:05 thesamet

I'm not sure I understand, this PR isn't changing anything about how the types are inferred, it just puts the asRecognized method to the GeneratedEnum, which is parent of all enum values. But if you're concerned about the inferred type, maybe we could rename it from Recognized to EnumNameRecognized?

sideeffffect avatar May 05 '20 15:05 sideeffffect

The concern is this:

val x = Seq(Weather.RAIN, Weather.SUNSHINE)

The inferred type of x would be Seq[Weather.Recognized], or Seq[WeatherRecognized] (if we go with the proposal from the previous comment). This addition would be unnecessary noise for most users.

thesamet avatar May 05 '20 15:05 thesamet

I think I see what you mean. But I think that has been already fixed in this PR, no? The enum cases now don't inherit only from Recognized (as was the case when I opened the PR), I reverted this change, so things are back to normal, where enum cases inherit both from the parent sealed trait and Recognized, as before. I updated the documentation to reflect that.

sideeffffect avatar Jun 02 '20 19:06 sideeffffect

Closing due to inactivity.

thesamet avatar Oct 17 '23 17:10 thesamet

Hello @thesamet , oh how time flies :sweat_smile: This must have slipped my mind.

Would you still be open to merging this if I revived the PR, incorporated the feedback, etc?

sideeffffect avatar Oct 17 '23 21:10 sideeffffect

Hey @sideeffffect , time flies! If you're still interested, happy to review. Since it's been a while - it would be great if you can file a corresponding issue describing what problem we're here to solve, and what is the proposed solution. Also, is this change breaking in the sense that it would only go on the next release (0.12.x) ?

thesamet avatar Oct 17 '23 21:10 thesamet