title: Is there a way to nest an enum within a data class in Kotlin?
body: <p>Is there a way to nest an enum within a data class in Kotlin?  </p>
  
  <pre><code>data class D(val a:Any) {
      enum class E {F,G}
      ...
  }
  </code></pre>
  
  <p>Or to declare it inline within a function?  </p>
  
  <pre><code>fun foo() {
      enum class E {F,G}
      doSomething()
  }
  </code></pre>
  
  <p>I can't find documentation on the rules for where enums are allowed to be declared.</p>