title: Bug or Feature: Kotlin allows to change 'val' to 'var' in inheritance
body: <p>I just started to explore the language Kotlin. I'm struggling with inheritance, var&amp;val and side-effects.</p>
  
  <p>If I declare a trait <code>A</code> with a <code>val x</code> and override <code>x</code> in <code>AImpl</code> it is possible to override it as <code>var</code> (see code below). Surprisingly the <code>print()</code> method in <code>A</code> is affected by the reassignment of <code>x</code> even though <code>x</code> is a value in <code>A</code>. Is this a bug or a feature?</p>
  
  <p>Code:</p>
  
  <pre><code>trait A {
    fun print() {
      println("A.x = $x")
    }
  
    val x : Int;
  }
  
  class AImpl(x : Int) : A {
    override var x = x; // seems like x can be overriden as `var`
  }
  
  fun main(args: Array&lt;String&gt;) {
  
    val a = AImpl(2)
  
    a.print() // A.x = 2
  
    a.x = 3; // x can be changed
  
    // even though print() is defined in trait A
    // where x is val it prints x = 3
    a.print() // A.x = 3
  
  }
  </code></pre>
  
  <p>I'm aware of the fact that if I define <code>a</code> with type <code>A</code> explicitly it is not allowed to change <code>x</code>:</p>
  
  <pre><code>val a = AImpl(2) : A
  a.x = 3 // ERROR: value x cannot be reassigned
  </code></pre>
  
  <p>But as the first case shows, inheritance can cause side effects which are clearly not intended in <code>A</code>. How do I protect values from being changed by inheritance?</p>