diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/macro-without-xmacros-a.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-without-xmacros-b.check | 6 | ||||
-rw-r--r-- | test/files/neg/t6040.check | 2 | ||||
-rw-r--r-- | test/files/neg/t6952.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7324.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7324.scala | 57 | ||||
-rw-r--r-- | test/files/neg/t7388.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7388.scala | 1 | ||||
-rw-r--r-- | test/files/pos/t7329.scala | 1 | ||||
-rw-r--r-- | test/files/pos/t7377/Client_2.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t7377/Macro_1.scala | 7 | ||||
-rw-r--r-- | test/files/pos/t7377b.scala | 13 | ||||
-rw-r--r-- | test/files/run/bitsets.check | 4 | ||||
-rw-r--r-- | test/files/run/bitsets.scala | 14 | ||||
-rw-r--r-- | test/files/run/t4023.scala | 31 | ||||
-rw-r--r-- | test/files/run/t7319.check | 38 | ||||
-rw-r--r-- | test/files/run/t7319.scala | 13 | ||||
-rw-r--r-- | test/files/run/t7337.check | 1 | ||||
-rw-r--r-- | test/files/run/t7337.scala | 19 |
19 files changed, 217 insertions, 19 deletions
diff --git a/test/files/neg/macro-without-xmacros-a.check b/test/files/neg/macro-without-xmacros-a.check index ae6c6c695a..ec194be3a9 100644 --- a/test/files/neg/macro-without-xmacros-a.check +++ b/test/files/neg/macro-without-xmacros-a.check @@ -1,5 +1,5 @@ Macros_2.scala:5: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. This can be achieved by adding the import clause 'import scala.language.experimental.macros' or by setting the compiler option -language:experimental.macros. See the Scala docs for value scala.language.experimental.macros for a discussion @@ -7,11 +7,11 @@ why the feature needs to be explicitly enabled. def foo(x: Int): Int = macro foo_impl ^ Macros_2.scala:7: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. def bar(x: Int): Int = macro bar_impl ^ Macros_2.scala:11: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. def quux(x: Int): Int = macro quux_impl ^ three errors found diff --git a/test/files/neg/macro-without-xmacros-b.check b/test/files/neg/macro-without-xmacros-b.check index c3cadcf36a..c97850f0a9 100644 --- a/test/files/neg/macro-without-xmacros-b.check +++ b/test/files/neg/macro-without-xmacros-b.check @@ -1,5 +1,5 @@ Macros_2.scala:3: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. This can be achieved by adding the import clause 'import scala.language.experimental.macros' or by setting the compiler option -language:experimental.macros. See the Scala docs for value scala.language.experimental.macros for a discussion @@ -7,11 +7,11 @@ why the feature needs to be explicitly enabled. def foo(x: Int): Int = macro Impls.foo_impl ^ Macros_2.scala:5: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. def bar(x: Int): Int = macro Impls.bar_impl ^ Macros_2.scala:9: error: macro definition needs to be enabled -by making the implicit value language.experimental.macros visible. +by making the implicit value scala.language.experimental.macros visible. def quux(x: Int): Int = macro Impls.quux_impl ^ three errors found diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check index f91df0c46d..16c90ede7e 100644 --- a/test/files/neg/t6040.check +++ b/test/files/neg/t6040.check @@ -1,5 +1,5 @@ t6040.scala:1: error: extension of type scala.Dynamic needs to be enabled -by making the implicit value language.dynamics visible. +by making the implicit value scala.language.dynamics visible. This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. See the Scala docs for value scala.language.dynamics for a discussion diff --git a/test/files/neg/t6952.check b/test/files/neg/t6952.check index f1e1881404..1a591d02c6 100644 --- a/test/files/neg/t6952.check +++ b/test/files/neg/t6952.check @@ -1,5 +1,5 @@ t6952.scala:2: error: extension of type scala.Dynamic needs to be enabled -by making the implicit value language.dynamics visible. +by making the implicit value scala.language.dynamics visible. This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. See the Scala docs for value scala.language.dynamics for a discussion @@ -7,7 +7,7 @@ why the feature needs to be explicitly enabled. trait B extends Dynamic ^ t6952.scala:3: error: extension of type scala.Dynamic needs to be enabled -by making the implicit value language.dynamics visible. +by making the implicit value scala.language.dynamics visible. trait C extends A with Dynamic ^ two errors found diff --git a/test/files/neg/t7324.check b/test/files/neg/t7324.check new file mode 100644 index 0000000000..586947d5e7 --- /dev/null +++ b/test/files/neg/t7324.check @@ -0,0 +1,4 @@ +t7324.scala:2: error: Platform restriction: a parameter list's length cannot exceed 254. +class Bar( + ^ +one error found diff --git a/test/files/neg/t7324.scala b/test/files/neg/t7324.scala new file mode 100644 index 0000000000..81d7674d68 --- /dev/null +++ b/test/files/neg/t7324.scala @@ -0,0 +1,57 @@ +object Bar extends App +class Bar( +_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int, +_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int, +_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int, +_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int, +_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int, +_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int, +_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int, +_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int, +_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int, +_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int, +_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int, +_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int, +_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int, +_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int, +_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int, +_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int, +_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int, +_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int, +_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int, +_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int, +_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int, +_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int, +_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int, +_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int, +_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int, +_251: Int, _252: Int, _253: Int, _254: Int, _255: Int +) + +class BarOK( +_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int, +_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int, +_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int, +_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int, +_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int, +_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int, +_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int, +_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int, +_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int, +_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int, +_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int, +_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int, +_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int, +_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int, +_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int, +_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int, +_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int, +_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int, +_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int, +_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int, +_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int, +_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int, +_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int, +_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int, +_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int, +_251: Int, _252: Int, _253: Int, _254: Int) diff --git a/test/files/neg/t7388.check b/test/files/neg/t7388.check new file mode 100644 index 0000000000..0a29e04896 --- /dev/null +++ b/test/files/neg/t7388.check @@ -0,0 +1,4 @@ +t7388.scala:1: error: doesnotexist is not an enclosing class +class Test private[doesnotexist]() + ^ +one error found diff --git a/test/files/neg/t7388.scala b/test/files/neg/t7388.scala new file mode 100644 index 0000000000..9ce9ea11b3 --- /dev/null +++ b/test/files/neg/t7388.scala @@ -0,0 +1 @@ +class Test private[doesnotexist]() diff --git a/test/files/pos/t7329.scala b/test/files/pos/t7329.scala new file mode 100644 index 0000000000..76bf1fb9f5 --- /dev/null +++ b/test/files/pos/t7329.scala @@ -0,0 +1 @@ +class TwoParamSpecializedWithDefault[@specialized A, @specialized B](a: A, b: B = (??? : B))
\ No newline at end of file diff --git a/test/files/pos/t7377/Client_2.scala b/test/files/pos/t7377/Client_2.scala new file mode 100644 index 0000000000..5728956cca --- /dev/null +++ b/test/files/pos/t7377/Client_2.scala @@ -0,0 +1,11 @@ +object Test { + M.noop(List(1) match { case Nil => 0; case (x::xs) => x }) + + case class Foo(a: Int) + val FooAlias: Foo.type = Foo + M.noop(Foo(0) match { case FooAlias(_) => 0 }) + + case class Bar() + val BarAlias: Bar.type = Bar + M.noop(Bar() match { case BarAlias() => 0 }) +} diff --git a/test/files/pos/t7377/Macro_1.scala b/test/files/pos/t7377/Macro_1.scala new file mode 100644 index 0000000000..a0ec1d84af --- /dev/null +++ b/test/files/pos/t7377/Macro_1.scala @@ -0,0 +1,7 @@ +import language.experimental._ +import reflect.macros.Context + +object M { + def noopImpl[A](c: Context)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typeCheck(c.resetLocalAttrs(expr.tree))) + def noop[A](expr: A): A = macro noopImpl[A] +} diff --git a/test/files/pos/t7377b.scala b/test/files/pos/t7377b.scala new file mode 100644 index 0000000000..aeee800d57 --- /dev/null +++ b/test/files/pos/t7377b.scala @@ -0,0 +1,13 @@ +object Test { + List(1) match { case Nil => 0; case (x::xs) => x } + + case class Foo(a: Int) + val FooAlias: Foo.type = Foo + Foo(0) match { case FooAlias(_) => 0 } + Foo(0) match { case Foo(_) => 0 } + + case class Bar() + val BarAlias: Bar.type = Bar + Bar() match { case BarAlias() => 0 } + Bar() match { case Bar() => 0 } +} diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check index 41c2ccdcb8..9bbc769b72 100644 --- a/test/files/run/bitsets.check +++ b/test/files/run/bitsets.check @@ -42,6 +42,10 @@ b2:BitSet(5) b3:BitSet(5, 7) b4:BitSet(7) b0:BitSet(5, 6, 7) +bMax:BitSet(2147483647) +2147483647 +bLarge:BitSet(2000000001) +false is0 = BitSet() is1 = BitSet() is2 = BitSet(2) diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index d55f9e4e83..c88782cab7 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -115,6 +115,19 @@ object TestMutable3 { println(s"b0:$b0") } +object TestMutable4 { + import scala.collection.mutable.BitSet + + val bMax = BitSet(Int.MaxValue) + println(s"bMax:$bMax") + bMax.foreach(println) + + val bLarge = BitSet(2000000001) + println(s"bLarge:$bLarge") + + println(bMax == bLarge) +} + object TestImmutable { import scala.collection.immutable.BitSet @@ -190,6 +203,7 @@ object Test extends App { TestMutable TestMutable2 TestMutable3 + TestMutable4 TestImmutable TestImmutable2 } diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala index 4846fa31b4..38190cfa5c 100644 --- a/test/files/run/t4023.scala +++ b/test/files/run/t4023.scala @@ -7,17 +7,28 @@ object Test { object B5 extends B1 private object B6 extends B2 - val valuesTry1 = this.getClass.getDeclaredClasses - val valuesTry2 = C.getClass.getDeclaredClasses - val valuesTry3 = getClass.getDeclaredClasses + val classes1 = this.getClass.getDeclaredClasses + val classes2 = C.getClass .getDeclaredClasses + val classes3 = getClass .getDeclaredClasses + } + + // sortBy(_.getName) introduces additional classes which we don't want to see in C, + // so we call sortBy outside of C. + object TestHelper { + val valuesTry1 = C.classes1.sortBy(_.getName) + val valuesTry2 = C.classes2.sortBy(_.getName) + val valuesTry3 = C.classes3.sortBy(_.getName) } def main(args: Array[String]) { - println("Try 1: (" + C.valuesTry1.length + " classes)") - C.valuesTry1.foreach(println) - println("Try 2: (" + C.valuesTry2.length + " classes)") - C.valuesTry2.foreach(println) - println("Try 3: (" + C.valuesTry3.length + " classes)") - C.valuesTry3.foreach(println) + println("Try 1: (" + TestHelper.valuesTry1.length + " classes)") + TestHelper.valuesTry1.foreach(println) + println("Try 2: (" + TestHelper.valuesTry2.length + " classes)") + TestHelper.valuesTry2.foreach(println) + println("Try 3: (" + TestHelper.valuesTry3.length + " classes)") + TestHelper.valuesTry3.foreach(println) } -}
\ No newline at end of file + + +} + diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check new file mode 100644 index 0000000000..966736915e --- /dev/null +++ b/test/files/run/t7319.check @@ -0,0 +1,38 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class M[A] +defined class M + +scala> implicit def ma0[A](a: A): M[A] = null +warning: there were 1 feature warning(s); re-run with -feature for details +ma0: [A](a: A)M[A] + +scala> implicit def ma1[A](a: A): M[A] = null +warning: there were 1 feature warning(s); re-run with -feature for details +ma1: [A](a: A)M[A] + +scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0 +warning: there were 1 feature warning(s); re-run with -feature for details +convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int + +scala> convert(Some[Int](0)) +<console>:12: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int]) + --- because --- +argument expression's type is not compatible with formal parameter type; + found : Some[Int] + required: ?F forSome { type _$1 <: ?F forSome { type _$2 } } + convert(Some[Int](0)) + ^ +<console>:12: error: type mismatch; + found : Some[Int] + required: F[_ <: F[_]] + convert(Some[Int](0)) + ^ + +scala> 0 +res1: Int = 0 + +scala> diff --git a/test/files/run/t7319.scala b/test/files/run/t7319.scala new file mode 100644 index 0000000000..23ffeb977d --- /dev/null +++ b/test/files/run/t7319.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + // so we can provide the ambiguities, rather than relying in Predef implicits + override def extraSettings = "-Yno-predef" + override def code = """ +class M[A] +implicit def ma0[A](a: A): M[A] = null +implicit def ma1[A](a: A): M[A] = null +def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0 +convert(Some[Int](0)) +0""" // before the fix, this line, and all that followed, re-issued the implicit ambiguity error. +} diff --git a/test/files/run/t7337.check b/test/files/run/t7337.check new file mode 100644 index 0000000000..dd2b31f23c --- /dev/null +++ b/test/files/run/t7337.check @@ -0,0 +1 @@ +doesnotexist does not exist or is not a directory diff --git a/test/files/run/t7337.scala b/test/files/run/t7337.scala new file mode 100644 index 0000000000..d878182ed0 --- /dev/null +++ b/test/files/run/t7337.scala @@ -0,0 +1,19 @@ +import scala.tools.partest._ +import scala.tools.nsc._ +import util.{CommandLineParser} + +object Test extends DirectTest { + override def code = "class C" + override def newCompiler(args: String*): Global = { + val settings = newSettings((CommandLineParser tokenize ("-d doesnotexist " + extraSettings)) ++ args.toList) + newCompiler(settings) + } + + override def show() { + try { + newCompiler() + } catch { + case fe: FatalError => println(fe.getMessage) + } + } +} |