title: Kotlin: is it possible to have a constant property dependent on an implementation generic type?
body: <p>I have the following abstrac base class</p>
  
  <pre><code>abstract class Vec2t&lt;T : Number&gt;(open var x: T, open var y: T) {
  
      companion object {
          val SIZE = 2 * when (/** T instance type */) {
              is Byte, is Ubyte -&gt; 1
              is Short, is Ushort -&gt; 2
              is Int, is Uint, is Float -&gt; 4
              is Long, is Ulong, is Double -&gt; 8
              else -&gt; throw ArithmeticException("Type undefined")
          }
      }
  }
  </code></pre>
  
  <p>that is implemented, for example, by <code>Vec2</code></p>
  
  <pre><code>data class Vec2(override var x: Float, override var y: Float) : Vec2t&lt;Float&gt;(x, y)
  </code></pre>
  
  <p>I am wondering if it is possible to define <code>SIZE</code> in <code>Vec2t</code> and call on one of its implementation, for example <code>Vec2.SIZE</code></p>