diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2012-03-02 10:27:13 +0100 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2012-03-02 10:27:13 +0100 |
commit | 66271b123807340632c24d3dc83bb833f411cf30 (patch) | |
tree | 0bae36bb6af7cb86f85ecf343a2810f4a7deb264 /test/files | |
parent | 1852a7ddf7f8c5fb4a85e64b73123d333e698932 (diff) | |
parent | 54b541b103f79bdfff96227eeeac1d92d68165d8 (diff) | |
download | scala-66271b123807340632c24d3dc83bb833f411cf30.tar.gz scala-66271b123807340632c24d3dc83bb833f411cf30.tar.bz2 scala-66271b123807340632c24d3dc83bb833f411cf30.zip |
Merge branch 'master' into feature/pc-execution-contexts
Conflicts:
src/library/scala/collection/parallel/Combiner.scala
src/library/scala/collection/parallel/ParIterableLike.scala
src/library/scala/collection/parallel/mutable/ParCtrie.scala
Diffstat (limited to 'test/files')
48 files changed, 309 insertions, 19 deletions
diff --git a/test/files/neg/abstraction-from-volatile-type-error.check b/test/files/neg/abstraction-from-volatile-type-error.check new file mode 100644 index 0000000000..34ba0551a5 --- /dev/null +++ b/test/files/neg/abstraction-from-volatile-type-error.check @@ -0,0 +1,4 @@ +abstraction-from-volatile-type-error.scala:9: error: illegal abstraction from value with volatile type a.Tv + val tv : a.Tv + ^ +one error found diff --git a/test/files/neg/abstraction-from-volatile-type-error.scala b/test/files/neg/abstraction-from-volatile-type-error.scala new file mode 100644 index 0000000000..5afcb3ec7d --- /dev/null +++ b/test/files/neg/abstraction-from-volatile-type-error.scala @@ -0,0 +1,11 @@ +class A { + type T + type Tv = AnyRef with T +} + +object Test { + type B = a.type forSome { + val a : A + val tv : a.Tv + } +} diff --git a/test/files/neg/constructor-prefix-error.check b/test/files/neg/constructor-prefix-error.check new file mode 100644 index 0000000000..87e948881b --- /dev/null +++ b/test/files/neg/constructor-prefix-error.check @@ -0,0 +1,4 @@ +constructor-prefix-error.scala:6: error: Outer is not a legal prefix for a constructor + val x = new Outer#Inner + ^ +one error found diff --git a/test/files/neg/constructor-prefix-error.scala b/test/files/neg/constructor-prefix-error.scala new file mode 100644 index 0000000000..c2accea284 --- /dev/null +++ b/test/files/neg/constructor-prefix-error.scala @@ -0,0 +1,7 @@ +class Outer { + class Inner +} + +object Test { + val x = new Outer#Inner +} diff --git a/test/files/neg/error_dependentMethodTpeConversionToFunction.check b/test/files/neg/error_dependentMethodTpeConversionToFunction.check new file mode 100644 index 0000000000..3496a552c4 --- /dev/null +++ b/test/files/neg/error_dependentMethodTpeConversionToFunction.check @@ -0,0 +1,4 @@ +error_dependentMethodTpeConversionToFunction.scala:4: error: method with dependent type (x: AnyRef)x.type cannot be converted to function value + val x: Any => Any = foo + ^ +one error found diff --git a/test/files/neg/error_dependentMethodTpeConversionToFunction.scala b/test/files/neg/error_dependentMethodTpeConversionToFunction.scala new file mode 100644 index 0000000000..22649e5098 --- /dev/null +++ b/test/files/neg/error_dependentMethodTpeConversionToFunction.scala @@ -0,0 +1,5 @@ +// test DependentMethodTpeConversionToFunctionError +object Test { + def foo(x: AnyRef): x.type = x + val x: Any => Any = foo +}
\ No newline at end of file diff --git a/test/files/neg/error_tooManyArgsPattern.check b/test/files/neg/error_tooManyArgsPattern.check new file mode 100644 index 0000000000..ee401ad061 --- /dev/null +++ b/test/files/neg/error_tooManyArgsPattern.check @@ -0,0 +1,4 @@ +error_tooManyArgsPattern.scala:3: error: too many arguments for unapply pattern, maximum = 22 + case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7 + ^ +one error found diff --git a/test/files/neg/error_tooManyArgsPattern.scala b/test/files/neg/error_tooManyArgsPattern.scala new file mode 100644 index 0000000000..d55ba61001 --- /dev/null +++ b/test/files/neg/error_tooManyArgsPattern.scala @@ -0,0 +1,5 @@ +object Test { + def test(xs: Any) = xs match { // test error message TooManyArgsPatternError + case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7 + } +} diff --git a/test/files/neg/finitary-error.check b/test/files/neg/finitary-error.check new file mode 100644 index 0000000000..7bc92058ca --- /dev/null +++ b/test/files/neg/finitary-error.check @@ -0,0 +1,4 @@ +finitary-error.scala:3: error: class graph is not finitary because type parameter T is expansively recursive +trait C[T] extends A[C[B[T]]] + ^ +one error found diff --git a/test/files/neg/finitary-error.scala b/test/files/neg/finitary-error.scala new file mode 100644 index 0000000000..a48fcdc70f --- /dev/null +++ b/test/files/neg/finitary-error.scala @@ -0,0 +1,3 @@ +trait A[T] +trait B[T] +trait C[T] extends A[C[B[T]]] diff --git a/test/files/neg/parent-inherited-twice-error.check b/test/files/neg/parent-inherited-twice-error.check new file mode 100644 index 0000000000..521a6c19d0 --- /dev/null +++ b/test/files/neg/parent-inherited-twice-error.check @@ -0,0 +1,7 @@ +parent-inherited-twice-error.scala:2: error: trait A is inherited twice +class B extends A with A + ^ +parent-inherited-twice-error.scala:2: error: trait A is inherited twice +class B extends A with A + ^ +two errors found diff --git a/test/files/neg/parent-inherited-twice-error.scala b/test/files/neg/parent-inherited-twice-error.scala new file mode 100644 index 0000000000..7b433b9860 --- /dev/null +++ b/test/files/neg/parent-inherited-twice-error.scala @@ -0,0 +1,2 @@ +trait A +class B extends A with A diff --git a/test/files/neg/qualifying-class-error-1.check b/test/files/neg/qualifying-class-error-1.check new file mode 100644 index 0000000000..c70db9ba60 --- /dev/null +++ b/test/files/neg/qualifying-class-error-1.check @@ -0,0 +1,4 @@ +qualifying-class-error-1.scala:2: error: this can be used only in a class, object, or template +class B extends A(this.getClass.getName.length) + ^ +one error found diff --git a/test/files/neg/qualifying-class-error-1.scala b/test/files/neg/qualifying-class-error-1.scala new file mode 100644 index 0000000000..09152fe04c --- /dev/null +++ b/test/files/neg/qualifying-class-error-1.scala @@ -0,0 +1,2 @@ +class A(val i:Int) +class B extends A(this.getClass.getName.length) diff --git a/test/files/neg/qualifying-class-error-2.check b/test/files/neg/qualifying-class-error-2.check new file mode 100644 index 0000000000..50c2759685 --- /dev/null +++ b/test/files/neg/qualifying-class-error-2.check @@ -0,0 +1,4 @@ +qualifying-class-error-2.scala:9: error: A is not an enclosing class + protected[A] def f() {} + ^ +one error found diff --git a/test/files/neg/qualifying-class-error-2.scala b/test/files/neg/qualifying-class-error-2.scala new file mode 100644 index 0000000000..d3aa8664bd --- /dev/null +++ b/test/files/neg/qualifying-class-error-2.scala @@ -0,0 +1,11 @@ +package A { + trait X { + protected[A] def f() + } +} + +package B { + class Y extends A.X { + protected[A] def f() {} + } +} diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check index 78701f8533..3ef6665fe5 100644 --- a/test/files/neg/t200.check +++ b/test/files/neg/t200.check @@ -1,4 +1,4 @@ -t200.scala:7: error: method foo is defined twice +t200.scala:7: error: method foo is defined twice in t200.scala def foo: Int; ^ one error found diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check index 4f94a780a1..d642541e3e 100644 --- a/test/files/neg/t2779.check +++ b/test/files/neg/t2779.check @@ -1,4 +1,4 @@ -t2779.scala:16: error: method f is defined twice +t2779.scala:16: error: method f is defined twice in t2779.scala override def f = List(M1) ^ one error found diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check index 675ef910ee..0c2dfeb67a 100644 --- a/test/files/neg/t278.check +++ b/test/files/neg/t278.check @@ -4,7 +4,7 @@ t278.scala:5: error: overloaded method value a with alternatives: does not take type parameters println(a[A]) ^ -t278.scala:4: error: method a is defined twice +t278.scala:4: error: method a is defined twice in t278.scala def a = (p:A) => () ^ two errors found diff --git a/test/files/neg/t414.check b/test/files/neg/t414.check index a855497648..e15dbaea71 100644 --- a/test/files/neg/t414.check +++ b/test/files/neg/t414.check @@ -1,5 +1,5 @@ t414.scala:5: error: pattern type is incompatible with expected type; - found : object Empty + found : Empty.type required: IntMap[a] Note: if you intended to match against the class, try `case _: Empty[_]` or `case Empty()` case Empty => diff --git a/test/files/neg/t452.check b/test/files/neg/t452.check index 85197af21b..aac663068e 100644 --- a/test/files/neg/t452.check +++ b/test/files/neg/t452.check @@ -1,5 +1,5 @@ t452.scala:3: error: type mismatch; - found : Test.type (with underlying type object Test) + found : Test.type required: Test.Foo def this() = this(this); ^ diff --git a/test/files/neg/t4879.check b/test/files/neg/t4879.check index 49f3c73cf7..21cd329640 100644 --- a/test/files/neg/t4879.check +++ b/test/files/neg/t4879.check @@ -1,11 +1,11 @@ t4879.scala:6: error: pattern type is incompatible with expected type; - found : object C + found : C.type required: C Note: if you intended to match against the class, try `case _: C` or `case C(_)` case C => true ^ t4879.scala:10: error: pattern type is incompatible with expected type; - found : object D + found : D.type required: D[T,U,V] Note: if you intended to match against the class, try `case _: D[_,_,_]` or `case D(_,_,_)` case D => true diff --git a/test/files/neg/t5529.check b/test/files/neg/t5529.check new file mode 100644 index 0000000000..78a26aeb50 --- /dev/null +++ b/test/files/neg/t5529.check @@ -0,0 +1,12 @@ +t5529.scala:12: error: File is already defined as class File + type File + ^ +t5529.scala:10: error: class type required but test.Test.File found + sealed class Dir extends File { } + ^ +t5529.scala:10: error: illegal inheritance; super<none> + is not a subclass of the superclass Object + of the mixin trait ScalaObject + sealed class Dir extends File { } + ^ +three errors found diff --git a/test/files/neg/t5529.scala b/test/files/neg/t5529.scala new file mode 100644 index 0000000000..033009a8a6 --- /dev/null +++ b/test/files/neg/t5529.scala @@ -0,0 +1,13 @@ +// /scala/trac/5529/a.scala +// Tue Feb 28 13:11:28 PST 2012 + +package test; + +object Test { + sealed class File { + val i = 1 + } + sealed class Dir extends File { } + + type File +} diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check index 434c2dd002..5cdeebf079 100644 --- a/test/files/neg/t591.check +++ b/test/files/neg/t591.check @@ -1,4 +1,4 @@ -t591.scala:38: error: method input_= is defined twice +t591.scala:38: error: method input_= is defined twice in t591.scala def input_=(in : Input) = {} ^ one error found diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check index 4bfba5420b..44c316a95b 100644 --- a/test/files/neg/t800.check +++ b/test/files/neg/t800.check @@ -1,13 +1,13 @@ t800.scala:4: error: qualification is already defined as value qualification val qualification = false; ^ -t800.scala:8: error: method qualification is defined twice +t800.scala:8: error: method qualification is defined twice in t800.scala val qualification = false; ^ -t800.scala:12: error: value qualification is defined twice +t800.scala:12: error: value qualification is defined twice in t800.scala var qualification = false; ^ -t800.scala:16: error: method qualification is defined twice +t800.scala:16: error: method qualification is defined twice in t800.scala var qualification = false; ^ four errors found diff --git a/test/files/neg/t960.check b/test/files/neg/t960.check index d65b0cea93..603b1cb032 100644 --- a/test/files/neg/t960.check +++ b/test/files/neg/t960.check @@ -4,7 +4,10 @@ and method unapply in object List of type [a](xs: List[a])Option[(a, List[a])] match argument types (List[a]) case List(x, xs) => 7 ^ -t960.scala:12: error: method unapply is defined twice +t960.scala:22: error: cannot resolve overloaded unapply + case List(x, xs) => 7 + ^ +t960.scala:12: error: method unapply is defined twice in t960.scala def unapply[a](xs: List[a]): Option[Null] = xs match { ^ -two errors found +three errors found diff --git a/test/files/neg/t960.scala b/test/files/neg/t960.scala index 5101cf8433..36909626c1 100644 --- a/test/files/neg/t960.scala +++ b/test/files/neg/t960.scala @@ -17,4 +17,8 @@ object List { def foo[a](xs: List[a]) = xs match { case List(x, xs) => 7 } + + def bar(xs: Any) = xs match { // test error message OverloadedUnapplyError + case List(x, xs) => 7 + } } diff --git a/test/files/pos/local-objects.scala b/test/files/pos/local-objects.scala new file mode 100644 index 0000000000..ed7c50ead9 --- /dev/null +++ b/test/files/pos/local-objects.scala @@ -0,0 +1,9 @@ + + +object Main { + val x = { + object Boo + Boo + } +} + diff --git a/test/files/pos/package-case.scala b/test/files/pos/package-case.scala new file mode 100644 index 0000000000..906f1eb3f2 --- /dev/null +++ b/test/files/pos/package-case.scala @@ -0,0 +1,4 @@ +// a.scala +// Sat Jul 16 00:34:36 EDT 2011 + +package object io { case class TextReader() } diff --git a/test/files/pos/t1957.scala b/test/files/pos/t1957.scala new file mode 100644 index 0000000000..f80cf730ed --- /dev/null +++ b/test/files/pos/t1957.scala @@ -0,0 +1,38 @@ +object Test { + abstract class Settings {} + + abstract class Grist + { self => + type settingsType <: Settings + type moduleType <: Module {type settingsType = self.settingsType} + val module: moduleType + } + + abstract class Tool + { self => + type settingsType <: Settings + type moduleType = Module { type settingsType = self.settingsType } + type gristType = Grist { type moduleType <: self.moduleType; type settingsType <: self.settingsType } + + def inputGrist: List[gristType] + } + + abstract class Module + { self => + type settingsType <: Settings + final type commonModuleType = Module {type settingsType = self.settingsType} + type selfType >: self.type <: commonModuleType + + // BTW: if we use the commented out type declarations, the code compiles successfully + // type gristType = Grist {type settingsType <: self.settingsType; type moduleType <: commonModuleType } + + val tools: List[Tool {type settingsType = self.settingsType}] + + protected def f: List[commonModuleType] = + { + val inputGrists = tools.flatMap(_.inputGrist) // val inputGrists: List[gristType] = + inputGrists.map(_.module) + } + + } +} diff --git a/test/files/pos/t1987b/a.scala b/test/files/pos/t1987b/a.scala new file mode 100644 index 0000000000..ff27044b69 --- /dev/null +++ b/test/files/pos/t1987b/a.scala @@ -0,0 +1,7 @@ +package bug + +// goes with t1987b.scala +package object packageb { + def func(a: Int) = () + def func(a: String) = () +} diff --git a/test/files/pos/t1987b/b.scala b/test/files/pos/t1987b/b.scala new file mode 100644 index 0000000000..a469ca6ea8 --- /dev/null +++ b/test/files/pos/t1987b/b.scala @@ -0,0 +1,10 @@ +// compile with t1987a.scala + +package bug.packageb +// Note that the overloading works if instead of being in the package we import it: +// replace the above line with import bug.packageb._ + +class Client { + val x = func(1) // doesn't compile: type mismatch; found: Int(1) required: String + val y = func("1") // compiles +} diff --git a/test/files/pos/t2194.scala b/test/files/pos/t2194.scala new file mode 100644 index 0000000000..e87be509d1 --- /dev/null +++ b/test/files/pos/t2194.scala @@ -0,0 +1,8 @@ +// tricky to do differently? +class C + +object Test { + def f = { object o extends C; o} + val y: C = f + val x = f +} diff --git a/test/files/pos/t5406.scala b/test/files/pos/t5406.scala new file mode 100644 index 0000000000..c2e42c0ac3 --- /dev/null +++ b/test/files/pos/t5406.scala @@ -0,0 +1,4 @@ +object Wuffles { } +object Test { + def f = (Some(Wuffles): Option[Wuffles.type]) match { case Some(Wuffles) => println("Woof"); case _ => println("Meow") } +} diff --git a/test/files/run/si5380.scala b/test/files/run/si5380.scala new file mode 100644 index 0000000000..6083161a9b --- /dev/null +++ b/test/files/run/si5380.scala @@ -0,0 +1,6 @@ +object Test { + def main(args: Array[String]) { + val f = () => return try { 1 } catch { case _ => 0 } + f() + } +} diff --git a/test/files/run/spec-nlreturn.check b/test/files/run/spec-nlreturn.check new file mode 100644 index 0000000000..26cff07360 --- /dev/null +++ b/test/files/run/spec-nlreturn.check @@ -0,0 +1,2 @@ +scala.runtime.NonLocalReturnControl$mcI$sp +16 diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala new file mode 100644 index 0000000000..ec5e7229d3 --- /dev/null +++ b/test/files/run/spec-nlreturn.scala @@ -0,0 +1,16 @@ +object Test { + def f(): Int = { + try { + val g = 1 to 10 map { i => return 16 ; i } sum; + g + } + catch { case x: runtime.NonLocalReturnControl[_] => + println(x.getClass.getName) + x.value.asInstanceOf[Int] + } + } + + def main(args: Array[String]): Unit = { + println(f()) + } +} diff --git a/test/files/run/t5293-map.scala b/test/files/run/t5293-map.scala index 9e186894fc..2707aed07e 100644 --- a/test/files/run/t5293-map.scala +++ b/test/files/run/t5293-map.scala @@ -75,8 +75,8 @@ object Test extends App { // println(scalamap) // println(scalaparmap) - assert(scalamap < (javamap * 4)) - assert(scalaparmap < (javamap * 4)) + assert(scalamap < (javamap * 10), "scalamap: " + scalamap + " vs. javamap: " + javamap) + assert(scalaparmap < (javamap * 10), "scalaparmap: " + scalaparmap + " vs. javamap: " + javamap) } diff --git a/test/files/run/t5293.scala b/test/files/run/t5293.scala index de1efaec4a..01ead45d2a 100644 --- a/test/files/run/t5293.scala +++ b/test/files/run/t5293.scala @@ -70,8 +70,8 @@ object Test extends App { val scalaset = benchScala(set) val scalaparset = benchScalaPar(set) - assert(scalaset < (javaset * 4)) - assert(scalaparset < (javaset * 4)) + assert(scalaset < (javaset * 8), "scalaset: " + scalaset + " vs. javaset: " + javaset) + assert(scalaparset < (javaset * 8), "scalaparset: " + scalaparset + " vs. javaset: " + javaset) } diff --git a/test/files/run/t5527.check b/test/files/run/t5527.check new file mode 100644 index 0000000000..bdd5ac8295 --- /dev/null +++ b/test/files/run/t5527.check @@ -0,0 +1,21 @@ +[[syntax trees at end of parser]]// Scala source: newSource1 +package <empty> { + abstract trait Test extends scala.ScalaObject { + def $init$() = { + () + }; + def sth: scala.Unit = { + /** Some comment here */ + object Maybe extends scala.ScalaObject { + def <init>() = { + super.<init>(); + () + }; + /** Some comment inside */ + def nothing() = () + }; + () + } + } +} + diff --git a/test/files/run/t5527.scala b/test/files/run/t5527.scala new file mode 100644 index 0000000000..8280ee06ba --- /dev/null +++ b/test/files/run/t5527.scala @@ -0,0 +1,41 @@ +import scala.tools.partest._ +import java.io._ +import scala.tools.nsc._ +import scala.tools.nsc.util.CommandLineParser +import scala.tools.nsc.doc.{Settings, DocFactory} +import scala.tools.nsc.reporters.ConsoleReporter + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path + + override def code = """ + // SI-5527 + trait Test { + def sth { + /** Some comment here */ + object Maybe { + /** Some comment inside */ + def nothing() = () + } + } + } + """.trim + + override def show(): Unit = { + // redirect err to out, for logging + val prevErr = System.err + System.setErr(System.out) + compile() + System.setErr(prevErr) + } + + override def newCompiler(args: String*): Global = { + // we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree + val settings = new Settings(_ => ()) + val command = new ScalaDoc.Command((CommandLineParser tokenize extraSettings) ++ args.toList, settings) + new DocFactory(new ConsoleReporter(settings), settings).compiler + } + + override def isDebug = false // so we don't get the newSettings warning +} diff --git a/test/files/run/t5530.check b/test/files/run/t5530.check new file mode 100644 index 0000000000..1013e3356f --- /dev/null +++ b/test/files/run/t5530.check @@ -0,0 +1,2 @@ +something like this + 7 now works!. diff --git a/test/files/run/t5530.flags b/test/files/run/t5530.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/run/t5530.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/files/run/t5530.scala b/test/files/run/t5530.scala new file mode 100644 index 0000000000..c8109a4004 --- /dev/null +++ b/test/files/run/t5530.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(s"""something like this + ${3+4} now works!.""") +}
\ No newline at end of file diff --git a/test/files/run/t5532.flags b/test/files/run/t5532.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/run/t5532.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/files/run/t5532.scala b/test/files/run/t5532.scala new file mode 100644 index 0000000000..75004730bf --- /dev/null +++ b/test/files/run/t5532.scala @@ -0,0 +1,4 @@ +object Test extends App { + val x = s"1" + val y = s"2" +}
\ No newline at end of file diff --git a/test/files/run/tailcalls.check b/test/files/run/tailcalls.check index 7670962db2..f123bc8f25 100644 --- a/test/files/run/tailcalls.check +++ b/test/files/run/tailcalls.check @@ -45,8 +45,7 @@ test TailCall.g3 was successful test TailCall.h1 was successful test NonTailCall.f1 0 1 2 was successful -test NonTailCall.f2 was successful - +test NonTailCall.f2 test TailCall.b1 was successful test TailCall.b2 was successful test FancyTailCalls.tcTryLocal was successful |