4

Just instantiating a class by typing the following into a Worksheet (note, Worksheet, created with File > New > Scala Worksheet, a .sc file, not a normal .scala file) and clicking Save causes a spurious error:

enter image description here

Mouseover:

enter image description here

"Multiple markers at this line - illegal start of simple expression - ';' expected but identifier found."

I doubt something as simple as this could have slipped through testing so maybe it's a configuration issue. I've tried it on 2 machines and get the same behaviour:

1) Windows 7 with Eclipse Helios

2) Windows XP with Eclipse Indigo - clean download from Typesafe website

Any ideas? Do other people get this on their setup?

Luigi Plinge
  • 50,650
  • 20
  • 113
  • 180

2 Answers2

4

During the Martin Odersky lectures on Coursera I noticed that he declares his classes outside the main object in his workbooks.

I hope this helps

object Worksheet {
  new Foo
}

class Foo
iain
  • 10,798
  • 3
  • 37
  • 41
  • 1
    Yes, great course, just finished assignment 3... but an inner class is a 100% legitimate scala code, so I assume he is doing it for either scoping or to avoid the bug (p.s. I love the shaun the sheep / timmy time avatar) – Eran Medan Oct 07 '12 at 08:49
3

This bug was fixed in the Scala compiler, but the fix is not in the version shipped with the milestone release.

If you update to a nightly build of the Scala IDE, you should be able to use this code pattern.

Iulian Dragos
  • 5,692
  • 23
  • 31
  • Thanks, but I can't get the nightly build running. If I try to install it, I get a bunch of conflicting dependencies: http://pastebin.com/TL90ReEF. So I tried uninstalling the existing Scala IDE and now Eclipse won't boot at all (IllegalStateException). – Luigi Plinge Oct 07 '12 at 10:44
  • It looks like a problem with the Typesafe IDE. We're [looking into it](https://www.assembla.com/spaces/typesafe_stack/tickets/68#/activity/ticket:68). – Iulian Dragos Oct 07 '12 at 12:24