9

Making a migration from 2.8.1 to 2.9.1 found interesting thing. Tried to write this in console:

>>import collection.immutable.Set.Set4
>>new Set4[Int](1,2,3,4)

It gives:

java.lang.Error: Unexpected New
    at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:34)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bac
..........................
That entry seems to have slain the compiler.  Shall I replayscala:660)
your session? I can re-run each line except the last one.reach(ListBuffer.scala:
[y/n]?

I am using Scala version 2.9.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_26).
And same things happen with classes Set3 and Set2.
Are these known issues?
Or, maybe, I am making something wrong?
In scala 2.8.1 console it works, and returns:

res0: collection.immutable.Set.Set4[Int] = Set(1,2,3,4)

Must I report about these as bug?

Rinat Tainov
  • 1,479
  • 2
  • 19
  • 39
  • Is there a reason you use `Set4` directly? – soc Sep 15 '11 at 13:46
  • Yes, I want to have a key with four integers, that will be frequently used with Set operations(as |,&,&~), because of it wanted to have an object with optimized implementation. – Rinat Tainov Sep 15 '11 at 13:50
  • 2
    `Set(1,2,3,4).isInstanceOf[collection.immutable.Set.Set4[Int]] == true` this happens automatically already. – soc Sep 15 '11 at 14:00
  • Cool, thanks, works perfect. If there is no reason to direct call, why we could import Set2, Set3 and Set4 to scope and use them directly? – Rinat Tainov Sep 15 '11 at 14:09
  • I can't think of one, except less method forwarding :-) – soc Sep 15 '11 at 14:55

1 Answers1

7

Yes. This is a compiler bug, go ahead and report it.

jpalecek
  • 47,058
  • 7
  • 102
  • 144
  • (Verified on 2.10. Don't forget to post the issue number here again :D) – soc Sep 15 '11 at 13:44
  • Thanks! If I want to participate in resolving SI bugs, how I must start? – Rinat Tainov Sep 17 '11 at 16:35
  • If you really feel like you can do compiler hacking, just try debugging the issue, just as it were a bug in a project of yours, and post your results as comments to the thread. – Blaisorblade Oct 09 '11 at 12:59
  • If, instead, you want to write a more helpful bug report, you can start by giving a complete stack trace, verifying if the bug is current on a current snapshot - or at least telling the authors that it was verified by somebody. Also, I feel like the information should be given _in_ the bug report, not through a link to this site. Extract all the relevant information (e.g. it worked on Scala 2.8.1), and only that. See also: http://stackoverflow.com/questions/240323/how-to-report-bugs-the-smart-way – Blaisorblade Oct 09 '11 at 13:10
  • A final possibility is that you might also start using git bisect on this repo (https://github.com/scala/scala) to discover when the bug was introduced. But that's already quite some work. – Blaisorblade Oct 09 '11 at 13:12