question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested ValueEnums don't work

See original GitHub issue

I’m converting some of my stuff to the StringEnumEntry, (Thanks!) and I’m noticing a few things I did earlier (With stock EnumEntry) that don’t work with this. It’s quite possible the answers will be “don’t do that”.

I’d set up an object with all the objects associated with a use case. This allowed a single easy import statement to get all the relevant symbols. This doesn’t compile:

sealed abstract class ParameterName(val value: String) extends StringEnumEntry
object ParameterConstants extends StringEnum[ParameterName] {
  object FOO extends ParameterName("foo")

  override def values = findValues

  sealed abstract class FooValue(val value: String) extends StringEnumEntry
  object FooValues extends StringEnum[FooValue] {
    object A extends FooValue("a")
    object B extends FooValue("b")

    override def values = findValues
  }

}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
LPTKcommented, Aug 9, 2016

Agreed. I may look into a prototype to find out when I have time 😉

0reactions
lloydmetacommented, Aug 22, 2016

Added support for this by switching a few things in the way constructor parameters are resolved. Added a test case for it too.

To use it, update to 1.4.11.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't access enumerands of nested private enum
I'm using Microsoft Visual Studio 2013 to compile a C++ class with some internal state; (let's say) color and texture. Each has a...
Read more >
[BUG] docs don't show nested enum attribute for body #329
I have a post method with the body as pydantic object, with one attribute as Enum object; All validation works perfectly; However, ...
Read more >
Nested Enums: The What, Why and When | by Steven Curtis
We can add enums within enums, or even within a Struct or a Class in order to make our software design come alive....
Read more >
Nested "enum"s should not be declared static
According to the Java Language Specification-8.9: Nested enum types are implicitly static . So there's no need to declare them static explicitly.
Read more >
Language Guide (proto3) | Protocol Buffers - Google Developers
Defining A Message Type; Scalar Value Types; Default Values; Enumerations; Using Other Message Types; Nested Types; Updating A Message Type; Unknown Fields ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found