What needs to be done to have the value "Value" in the enumeration?

This code does not compile:

object Token extends Enumeration {
    type ID = Value
    val Key, Value = Value
}

error: recursive value The value requires type

What needs to be done to have the value "Value" in the enumeration?

+3
source share
1 answer

This is not possible because it is Valuealready a final member Enumeration- an obvious proposition - to call your field instead Val.

+3
source

Source: https://habr.com/ru/post/1735579/


All Articles