diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/instrumented/InstrumentationTest.check | 4 | ||||
-rw-r--r-- | test/files/instrumented/InstrumentationTest.scala | 16 | ||||
-rw-r--r-- | test/files/neg/t3234.check | 2 | ||||
-rw-r--r-- | test/files/neg/t3234.flags (renamed from test/files/pos/t3234.flags) | 0 | ||||
-rw-r--r-- | test/files/neg/t3234.scala (renamed from test/files/pos/t3234.scala) | 0 | ||||
-rw-r--r-- | test/files/pos/t5958.scala | 15 | ||||
-rw-r--r-- | test/files/pos/t6029.scala | 3 | ||||
-rw-r--r-- | test/files/run/rawstrings.check | 1 | ||||
-rw-r--r-- | test/files/run/rawstrings.scala | 3 | ||||
-rw-r--r-- | test/files/run/t4560.check | 8 | ||||
-rw-r--r-- | test/files/run/t4560.scala | 65 | ||||
-rw-r--r-- | test/files/run/t4560b.check | 2 | ||||
-rw-r--r-- | test/files/run/t4560b.scala | 28 | ||||
-rw-r--r-- | test/pending/run/t4560.scala | 9 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6140.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6140.scala | 18 |
16 files changed, 145 insertions, 30 deletions
diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check index 3652df270a..f0f447560a 100644 --- a/test/files/instrumented/InstrumentationTest.check +++ b/test/files/instrumented/InstrumentationTest.check @@ -1,4 +1,8 @@ true Method call statistics: + 1 Foo1.<init>()V + 1 Foo1.someMethod()I + 1 instrumented/Foo2.<init>()V + 1 instrumented/Foo2.someMethod()I 1 scala/Predef$.println(Ljava/lang/Object;)V 1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean; diff --git a/test/files/instrumented/InstrumentationTest.scala b/test/files/instrumented/InstrumentationTest.scala index ec5314c624..0e53f80857 100644 --- a/test/files/instrumented/InstrumentationTest.scala +++ b/test/files/instrumented/InstrumentationTest.scala @@ -1,11 +1,27 @@ import scala.tools.partest.instrumented.Instrumentation._ +/** We check if classes put in empty package are properly instrumented */ +class Foo1 { + def someMethod = 0 +} + +/** We check if classes put in `instrumented` package are properly instrumented */ +package instrumented { + class Foo2 { + def someMethod = 0 + } +} + /** Tests if instrumentation itself works correctly */ object Test { def main(args: Array[String]) { // force predef initialization before profiling Predef startProfiling() + val foo1 = new Foo1 + foo1.someMethod + val foo2 = new instrumented.Foo2 + foo2.someMethod // should box the boolean println(true) stopProfiling() diff --git a/test/files/neg/t3234.check b/test/files/neg/t3234.check new file mode 100644 index 0000000000..477b021e5e --- /dev/null +++ b/test/files/neg/t3234.check @@ -0,0 +1,2 @@ +error: there were 1 inliner warnings; re-run with -Yinline-warnings for details +one error found diff --git a/test/files/pos/t3234.flags b/test/files/neg/t3234.flags index c9cefdc4b9..c9cefdc4b9 100644 --- a/test/files/pos/t3234.flags +++ b/test/files/neg/t3234.flags diff --git a/test/files/pos/t3234.scala b/test/files/neg/t3234.scala index 443d0467f0..443d0467f0 100644 --- a/test/files/pos/t3234.scala +++ b/test/files/neg/t3234.scala diff --git a/test/files/pos/t5958.scala b/test/files/pos/t5958.scala new file mode 100644 index 0000000000..3b910f3633 --- /dev/null +++ b/test/files/pos/t5958.scala @@ -0,0 +1,15 @@ +class Test { + def newComponent(u: Universe): u.Component = ??? + + class Universe { self => + class Component + + newComponent(this): this.Component // error, but should be fine since this is a stable reference + newComponent(self): self.Component // error, but should be fine since this is a stable reference + newComponent(self): this.Component // error, but should be fine since this is a stable reference + newComponent(this): self.Component // error, but should be fine since this is a stable reference + + val u = this + newComponent(u): u.Component // ok + } +}
\ No newline at end of file diff --git a/test/files/pos/t6029.scala b/test/files/pos/t6029.scala new file mode 100644 index 0000000000..8f1bbb4ebf --- /dev/null +++ b/test/files/pos/t6029.scala @@ -0,0 +1,3 @@ +final case class V[A](x: A) extends AnyVal { + def flatMap[B](f: A => V[B]) = if (true) this else f(x) +} diff --git a/test/files/run/rawstrings.check b/test/files/run/rawstrings.check new file mode 100644 index 0000000000..36e63594df --- /dev/null +++ b/test/files/run/rawstrings.check @@ -0,0 +1 @@ +[\n\t'"$] diff --git a/test/files/run/rawstrings.scala b/test/files/run/rawstrings.scala new file mode 100644 index 0000000000..9df64f6625 --- /dev/null +++ b/test/files/run/rawstrings.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(raw"[\n\t'${'"'}$$]") +} diff --git a/test/files/run/t4560.check b/test/files/run/t4560.check index fd3c81a4d7..f8cb0833ae 100644 --- a/test/files/run/t4560.check +++ b/test/files/run/t4560.check @@ -1,2 +1,6 @@ -5 -5 +'Test +Success 1 +'Test +Success 2 +'Test +Success 3 diff --git a/test/files/run/t4560.scala b/test/files/run/t4560.scala index 1392077e46..9979199067 100644 --- a/test/files/run/t4560.scala +++ b/test/files/run/t4560.scala @@ -1,39 +1,66 @@ -object Pimper { - implicit def pimp(i: Int) = new { - def test: String = i.toString - } -} +// SI-4560 (and SI-4601): Reflection caches are expected in the wrong classfiles +// with various differing constellations of self-types. This leads to runtime exceptions +// when the reflection caches are accessed. This tests both reflection cache accesses +// for structural type method invocations (`y.f()`) (SI-4560) and accesses to symbols which are +// handled similarly (SI-4601) -trait A +// TEST 1 +// self-type is other trait -trait B { - self: A => +trait Aa +trait Ab - def test { - import Pimper.pimp +trait B { + self: Aa with Ab => - println(5.test) + def y = new { def f() = println("Success 1") } + def fail() = { + println('Test) + y.f() } } +object Test1 extends Aa with Ab with B + +// TEST 2 +// self-type is class + class A2 trait B2 { self: A2 => - def test { - import Pimper.pimp + def y = new { def f() = println("Success 2") } + def fail() = { + println('Test) + y.f() + } +} + +object Test2 extends A2 with B2 + +// TEST 3 +// self-type is singleton type + +trait B3 { + this: Test3.type => - println(5.test) + def y = new { def f() = println("Success 3") } + def fail() = { + println('Test) + y.f() } } -object Test extends A with B { +object Test3 extends B3 { + def test { fail() } +} + +object Test { def main(args: Array[String]) { - test - Test2.test + Test1.fail() + Test2.fail() + Test3.fail() } } -object Test2 extends A2 with B2 - diff --git a/test/files/run/t4560b.check b/test/files/run/t4560b.check new file mode 100644 index 0000000000..7ee6e19b28 --- /dev/null +++ b/test/files/run/t4560b.check @@ -0,0 +1,2 @@ +23 +SUCCESS diff --git a/test/files/run/t4560b.scala b/test/files/run/t4560b.scala new file mode 100644 index 0000000000..97fe00ce37 --- /dev/null +++ b/test/files/run/t4560b.scala @@ -0,0 +1,28 @@ +object Outer { + class Tester + private[Outer] trait B4 { _: Tester => + protected val FREQ = 23 + def fail() = { + println(FREQ) + } + } + object C4 extends Tester with B4 +} + +object Outer2 { + abstract class A5 + private[Outer2] trait C5 { + def impl() { println("SUCCESS") } + } + trait B5 extends C5 { self: A5 => + def fail() { impl() } + } + object Test5 extends A5 with B5 with C5 +} + +object Test { + def main(args: Array[String]): Unit = { + Outer.C4.fail() + Outer2.Test5.fail() + } +} diff --git a/test/pending/run/t4560.scala b/test/pending/run/t4560.scala deleted file mode 100644 index fe62136319..0000000000 --- a/test/pending/run/t4560.scala +++ /dev/null @@ -1,9 +0,0 @@ -trait B { - this: Test.type => - - def y = new { def f() = () } - def fail() = y.f() -} -object Test extends B { - def main(args: Array[String]): Unit = fail() -}
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6140.check b/test/scaladoc/run/SI-6140.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/SI-6140.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/SI-6140.scala b/test/scaladoc/run/SI-6140.scala new file mode 100644 index 0000000000..4bb9a4dc85 --- /dev/null +++ b/test/scaladoc/run/SI-6140.scala @@ -0,0 +1,18 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // This caused an infinite recursion in method inline() in CommentFactory.scala + override def code = """ + /** {{ code? }} */ + class C + """ + + // no need for special settings + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + // if it doesn't hang, the test is passed + } +} |