Permalink
Browse files

Add a test case from the comments of SI-6666.

This one lands in the new implementation restriction
which beats the VerifyError.
  • Loading branch information...
1 parent fd61254 commit 4c34280e5bb3e48db35d97d890e4f5f1c5fb3a26 @retronym retronym committed Jan 28, 2013
Showing with 21 additions and 0 deletions.
  1. +4 −0 test/files/neg/t6666b.check
  2. +17 −0 test/files/neg/t6666b.scala
View
4 test/files/neg/t6666b.check
@@ -0,0 +1,4 @@
+t6666b.scala:6: error: Implementation restriction: access of object TreeOrd$1 from object TreeOrd$2, would require illegal premature access to the unconstructed `this` of class Test
+ implicit object TreeOrd extends Ordering[K](){
+ ^
+one error found
View
17 test/files/neg/t6666b.scala
@@ -0,0 +1,17 @@
+import scala.collection.immutable.TreeMap
+import scala.math.Ordering
+
+class Test[K](param:TreeMap[K,Int]){
+ def this() = this({
+ implicit object TreeOrd extends Ordering[K](){
+ def compare(a: K, b: K) = {
+ -1
+ }
+ }
+ new TreeMap[K, Int]()
+ })
+}
+
+object Test extends App {
+ new Test()
+}

0 comments on commit 4c34280

Please sign in to comment.