title: Intellij worksheet and classes defined in it
body: <p>I'm following along the Coursera course on functional programming in Scala and came along a weird behavior of the worksheet repl.</p>
  
  <p>In the course a worksheet with the following code should give the following results on the right:</p>
  
  <pre><code>object rationals {
  val x = new Rational(1, 2)              &gt; x : Rational = Rational@&lt;hash_code&gt;
     x.numer                              &gt; res0: Int = 1
     y. denom                             &gt; res1: Int = 2
  }
  
  class Rational(x: Int, y: Int) {
     def numer = x
     def denom = y
  }
  </code></pre>
  
  <p>What I get is</p>
  
  <pre><code>object rationals {                      &gt; defined module rationals
  val x = new Rational(1, 2)              
     x.numer                              
     y. denom                             
  }
  
  class Rational(x: Int, y: Int) {        &gt; defined class Rational
     def numer = x
     def denom = y
  }
  </code></pre>
  
  <p>Only after moving the <code>class</code> into the <code>object</code> I got the same result as in the code.</p>
  
  <ul>
  <li>Is this caused by Intellij, or have there been changes in Scala?</li>
  <li>Are there other ways around this?</li>
  </ul>