Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scala error : ';' expected but 'import' found

Tags:

scala

When I add this class to a scala worksheet I receive the error :

';' expected but 'import' found.

object polynomials {

    class Poly(val terms: Map[Int , Double]) {
        def + (other: Poly) = new Poly(terms ++ other.terms)
    }

    val p1 = new Poly(Map(1 -> 2.0, 3 -> 4.0, 5 -> 6.2))

}

The class looks fine to me, is there something missing ?

like image 890
user701254 Avatar asked Oct 27 '12 15:10

user701254


1 Answers

This was a bug. A new version of the Worksheet was released a few days ago that fixes it, so go to Help > Check for updates, and the new version should be available for installation. I tried your code on Worksheet 0.1.2.v-2_09-201210230838-85b738a and it's fine.

like image 190
Luigi Plinge Avatar answered Nov 04 '22 18:11

Luigi Plinge