diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/buildmanager/t2650_1/t2650_1.check | 1 | ||||
-rw-r--r-- | test/files/buildmanager/t2657/t2657.check | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | test/files/jvm/interpreter.check | 741 | ||||
-rw-r--r-- | test/files/pos/generic-sigs.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t1439.flags | 2 | ||||
-rw-r--r-- | test/files/run/constrained-types.check | 7 | ||||
-rw-r--r-- | test/files/run/existentials-in-compiler.check | 16 | ||||
-rw-r--r-- | test/files/run/macro-reflective-mamd-normal-mi.check | 1 | ||||
-rw-r--r-- | test/files/run/macro-repl-basic.check | 105 | ||||
-rw-r--r-- | test/files/run/macro-repl-basic.scala | 4 | ||||
-rw-r--r-- | test/files/run/macro-repl-dontexpand.scala | 4 | ||||
-rw-r--r-- | test/files/run/repl-parens.check | 2 | ||||
-rw-r--r-- | test/files/run/repl-parens.scala | 4 | ||||
-rw-r--r-- | test/files/run/repl-power.check | 65 | ||||
-rw-r--r-- | test/files/run/t4172.check | 2 | ||||
-rw-r--r-- | test/files/run/t4317/S_1.scala | 2 | ||||
-rw-r--r-- | test/files/run/t4710.check | 1 |
17 files changed, 492 insertions, 470 deletions
diff --git a/test/files/buildmanager/t2650_1/t2650_1.check b/test/files/buildmanager/t2650_1/t2650_1.check index ecddb33620..f1e4b1b8bc 100644 --- a/test/files/buildmanager/t2650_1/t2650_1.check +++ b/test/files/buildmanager/t2650_1/t2650_1.check @@ -1,5 +1,6 @@ builder > A.scala B.scala compiling Set(A.scala, B.scala) +warning: there were 1 feature warnings; re-run with -feature for details Changes: Map() builder > A.scala compiling Set(A.scala) diff --git a/test/files/buildmanager/t2657/t2657.check b/test/files/buildmanager/t2657/t2657.check index 74ba87a21d..cd0357599c 100644 --- a/test/files/buildmanager/t2657/t2657.check +++ b/test/files/buildmanager/t2657/t2657.check @@ -1,5 +1,6 @@ builder > A.scala B.scala compiling Set(A.scala, B.scala) +warning: there were 1 feature warnings; re-run with -feature for details Changes: Map() builder > A.scala compiling Set(A.scala) diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index d93e314d8e..b9ff6afa2b 100755..100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,372 +1,375 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> // basics
-
-scala> 3+4
-res0: Int = 7
-
-scala> def gcd(x: Int, y: Int): Int = {
- if (x == 0) y
- else if (y == 0) x
- else gcd(y%x, x)
-}
-gcd: (x: Int, y: Int)Int
-
-scala> val five = gcd(15,35)
-five: Int = 5
-
-scala> var x = 1
-x: Int = 1
-
-scala> x = 2
-x: Int = 2
-
-scala> val three = x+1
-three: Int = 3
-
-scala> type anotherint = Int
-defined type alias anotherint
-
-scala> val four: anotherint = 4
-four: anotherint = 4
-
-scala> val bogus: anotherint = "hello"
-<console>:8: error: type mismatch;
- found : String("hello")
- required: anotherint
- (which expands to) Int
- val bogus: anotherint = "hello"
- ^
-
-scala> trait PointlessTrait
-defined trait PointlessTrait
-
-scala> val (x,y) = (2,3)
-x: Int = 2
-y: Int = 3
-
-scala> println("hello")
-hello
-
-scala>
-
-scala> // ticket #1513
-
-scala> val t1513 = Array(null)
-t1513: Array[Null] = Array(null)
-
-scala> // ambiguous toString problem from #547
-
-scala> val atom = new scala.xml.Atom()
-atom: scala.xml.Atom[Unit] = ()
-
-scala> // overriding toString problem from #1404
-
-scala> class S(override val toString : String)
-defined class S
-
-scala> val fish = new S("fish")
-fish: S = fish
-
-scala> // Test that arrays pretty print nicely.
-
-scala> val arr = Array("What's", "up", "doc?")
-arr: Array[String] = Array(What's, up, doc?)
-
-scala> // Test that arrays pretty print nicely, even when we give them type Any
-
-scala> val arrInt : Any = Array(1,2,3)
-arrInt: Any = Array(1, 2, 3)
-
-scala> // Test that nested arrays are pretty-printed correctly
-
-scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4))
-arrArrInt: Any = Array(Array(1, 2), Array(3, 4))
-
-scala>
-
-scala> // implicit conversions
-
-scala> case class Foo(n: Int)
-defined class Foo
-
-scala> case class Bar(n: Int)
-defined class Bar
-
-scala> implicit def foo2bar(foo: Foo) = Bar(foo.n)
-foo2bar: (foo: Foo)Bar
-
-scala> val bar: Bar = Foo(3)
-bar: Bar = Bar(3)
-
-scala>
-
-scala> // importing from a previous result
-
-scala> import bar._
-import bar._
-
-scala> val m = n
-m: Int = 3
-
-scala>
-
-scala> // stressing the imports mechanism
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala>
-
-scala>
-
-scala> val x1 = 1
-x1: Int = 1
-
-scala> val x2 = 1
-x2: Int = 1
-
-scala> val x3 = 1
-x3: Int = 1
-
-scala> val x4 = 1
-x4: Int = 1
-
-scala> val x5 = 1
-x5: Int = 1
-
-scala> val x6 = 1
-x6: Int = 1
-
-scala> val x7 = 1
-x7: Int = 1
-
-scala> val x8 = 1
-x8: Int = 1
-
-scala> val x9 = 1
-x9: Int = 1
-
-scala> val x10 = 1
-x10: Int = 1
-
-scala> val x11 = 1
-x11: Int = 1
-
-scala> val x12 = 1
-x12: Int = 1
-
-scala> val x13 = 1
-x13: Int = 1
-
-scala> val x14 = 1
-x14: Int = 1
-
-scala> val x15 = 1
-x15: Int = 1
-
-scala> val x16 = 1
-x16: Int = 1
-
-scala> val x17 = 1
-x17: Int = 1
-
-scala> val x18 = 1
-x18: Int = 1
-
-scala> val x19 = 1
-x19: Int = 1
-
-scala> val x20 = 1
-x20: Int = 1
-
-scala>
-
-scala> val two = one + x5
-two: Int = 2
-
-scala>
-
-scala> // handling generic wildcard arrays (#2386)
-
-scala> // It's put here because type feedback is an important part of it.
-
-scala> val xs: Array[_] = Array(1, 2)
-xs: Array[_] = Array(1, 2)
-
-scala> xs.size
-res2: Int = 2
-
-scala> xs.head
-res3: Any = 1
-
-scala> xs filter (_ == 2)
-res4: Array[_] = Array(2)
-
-scala> xs map (_ => "abc")
-res5: Array[String] = Array(abc, abc)
-
-scala> xs map (x => x)
-res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2)
-
-scala> xs map (x => (x, x))
-res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2))
-
-scala>
-
-scala> // interior syntax errors should *not* go into multi-line input mode.
-
-scala> // both of the following should abort immediately:
-
-scala> def x => y => z
-<console>:1: error: '=' expected but '=>' found.
- def x => y => z
- ^
-
-scala> [1,2,3]
-<console>:1: error: illegal start of definition
- [1,2,3]
- ^
-
-scala>
-
-scala>
-
-scala> // multi-line XML
-
-scala> <a>
-<b
- c="c"
- d="dd"
-/></a>
-res8: scala.xml.Elem =
-<a>
-<b c="c" d="dd"/></a>
-
-scala>
-
-scala>
-
-scala> /*
- /*
- multi-line comment
- */
-*/
-
-scala>
-
-scala>
-
-scala> // multi-line string
-
-scala> """
-hello
-there
-"""
-res9: String =
-"
-hello
-there
-"
-
-scala>
-
-scala> (1 + // give up early by typing two blank lines
-
-
-You typed two blank lines. Starting a new command.
-
-scala> // defining and using quoted names should work (ticket #323)
-
-scala> def `match` = 1
-match: Int
-
-scala> val x = `match`
-x: Int = 1
-
-scala>
-
-scala> // multiple classes defined on one line
-
-scala> sealed class Exp; class Fact extends Exp; class Term extends Exp
-defined class Exp
-defined class Fact
-defined class Term
-
-scala> def f(e: Exp) = e match { // non-exhaustive warning here
- case _:Fact => 3
-}
-<console>:18: warning: match is not exhaustive!
-missing combination Exp
-missing combination Term
-
- def f(e: Exp) = e match { // non-exhaustive warning here
- ^
-f: (e: Exp)Int
-
-scala>
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> // basics + +scala> 3+4 +res0: Int = 7 + +scala> def gcd(x: Int, y: Int): Int = { + if (x == 0) y + else if (y == 0) x + else gcd(y%x, x) +} +gcd: (x: Int, y: Int)Int + +scala> val five = gcd(15,35) +five: Int = 5 + +scala> var x = 1 +x: Int = 1 + +scala> x = 2 +x: Int = 2 + +scala> val three = x+1 +three: Int = 3 + +scala> type anotherint = Int +defined type alias anotherint + +scala> val four: anotherint = 4 +four: anotherint = 4 + +scala> val bogus: anotherint = "hello" +<console>:8: error: type mismatch; + found : String("hello") + required: anotherint + (which expands to) Int + val bogus: anotherint = "hello" + ^ + +scala> trait PointlessTrait +defined trait PointlessTrait + +scala> val (x,y) = (2,3) +x: Int = 2 +y: Int = 3 + +scala> println("hello") +hello + +scala> + +scala> // ticket #1513 + +scala> val t1513 = Array(null) +t1513: Array[Null] = Array(null) + +scala> // ambiguous toString problem from #547 + +scala> val atom = new scala.xml.Atom() +atom: scala.xml.Atom[Unit] = () + +scala> // overriding toString problem from #1404 + +scala> class S(override val toString : String) +defined class S + +scala> val fish = new S("fish") +fish: S = fish + +scala> // Test that arrays pretty print nicely. + +scala> val arr = Array("What's", "up", "doc?") +arr: Array[String] = Array(What's, up, doc?) + +scala> // Test that arrays pretty print nicely, even when we give them type Any + +scala> val arrInt : Any = Array(1,2,3) +arrInt: Any = Array(1, 2, 3) + +scala> // Test that nested arrays are pretty-printed correctly + +scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4)) +arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) + +scala> + +scala> // implicit conversions + +scala> case class Foo(n: Int) +defined class Foo + +scala> case class Bar(n: Int) +defined class Bar + +scala> implicit def foo2bar(foo: Foo) = Bar(foo.n) +warning: there were 1 feature warnings; re-run with -feature for details +foo2bar: (foo: Foo)Bar + +scala> val bar: Bar = Foo(3) +bar: Bar = Bar(3) + +scala> + +scala> // importing from a previous result + +scala> import bar._ +import bar._ + +scala> val m = n +m: Int = 3 + +scala> + +scala> // stressing the imports mechanism + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> + +scala> + +scala> val x1 = 1 +x1: Int = 1 + +scala> val x2 = 1 +x2: Int = 1 + +scala> val x3 = 1 +x3: Int = 1 + +scala> val x4 = 1 +x4: Int = 1 + +scala> val x5 = 1 +x5: Int = 1 + +scala> val x6 = 1 +x6: Int = 1 + +scala> val x7 = 1 +x7: Int = 1 + +scala> val x8 = 1 +x8: Int = 1 + +scala> val x9 = 1 +x9: Int = 1 + +scala> val x10 = 1 +x10: Int = 1 + +scala> val x11 = 1 +x11: Int = 1 + +scala> val x12 = 1 +x12: Int = 1 + +scala> val x13 = 1 +x13: Int = 1 + +scala> val x14 = 1 +x14: Int = 1 + +scala> val x15 = 1 +x15: Int = 1 + +scala> val x16 = 1 +x16: Int = 1 + +scala> val x17 = 1 +x17: Int = 1 + +scala> val x18 = 1 +x18: Int = 1 + +scala> val x19 = 1 +x19: Int = 1 + +scala> val x20 = 1 +x20: Int = 1 + +scala> + +scala> val two = one + x5 +two: Int = 2 + +scala> + +scala> // handling generic wildcard arrays (#2386) + +scala> // It's put here because type feedback is an important part of it. + +scala> val xs: Array[_] = Array(1, 2) +xs: Array[_] = Array(1, 2) + +scala> xs.size +res2: Int = 2 + +scala> xs.head +res3: Any = 1 + +scala> xs filter (_ == 2) +res4: Array[_] = Array(2) + +scala> xs map (_ => "abc") +res5: Array[String] = Array(abc, abc) + +scala> xs map (x => x) +res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2) + +scala> xs map (x => (x, x)) +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details +res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) + +scala> + +scala> // interior syntax errors should *not* go into multi-line input mode. + +scala> // both of the following should abort immediately: + +scala> def x => y => z +<console>:1: error: '=' expected but '=>' found. + def x => y => z + ^ + +scala> [1,2,3] +<console>:1: error: illegal start of definition + [1,2,3] + ^ + +scala> + +scala> + +scala> // multi-line XML + +scala> <a> +<b + c="c" + d="dd" +/></a> +res8: scala.xml.Elem = +<a> +<b c="c" d="dd"/></a> + +scala> + +scala> + +scala> /* + /* + multi-line comment + */ +*/ + +scala> + +scala> + +scala> // multi-line string + +scala> """ +hello +there +""" +res9: String = +" +hello +there +" + +scala> + +scala> (1 + // give up early by typing two blank lines + + +You typed two blank lines. Starting a new command. + +scala> // defining and using quoted names should work (ticket #323) + +scala> def `match` = 1 +match: Int + +scala> val x = `match` +x: Int = 1 + +scala> + +scala> // multiple classes defined on one line + +scala> sealed class Exp; class Fact extends Exp; class Term extends Exp +defined class Exp +defined class Fact +defined class Term + +scala> def f(e: Exp) = e match { // non-exhaustive warning here + case _:Fact => 3 +} +<console>:18: warning: match is not exhaustive! +missing combination Exp +missing combination Term + + def f(e: Exp) = e match { // non-exhaustive warning here + ^ +f: (e: Exp)Int + +scala> + +scala> plusOne: (x: Int)Int res0: Int = 6 res0: String = after reset diff --git a/test/files/pos/generic-sigs.scala b/test/files/pos/generic-sigs.scala index 40ec044656..b112766056 100644 --- a/test/files/pos/generic-sigs.scala +++ b/test/files/pos/generic-sigs.scala @@ -1,3 +1,5 @@ +import language.existentials + object A { def f1 = List(classOf[Int], classOf[String]) def f2 = List(classOf[String], classOf[Int]) @@ -15,4 +17,4 @@ object A { class Boppy[+T1,-T2] def g1 = new Boppy[t forSome { type t <: Int }, u forSome { type u <: String }] -}
\ No newline at end of file +} diff --git a/test/files/pos/t1439.flags b/test/files/pos/t1439.flags index 830f024342..d86a0144e8 100644 --- a/test/files/pos/t1439.flags +++ b/test/files/pos/t1439.flags @@ -1 +1 @@ --unchecked -Xfatal-warnings -language:higher-kinds
\ No newline at end of file +-unchecked -Xfatal-warnings -language:higherKinds
\ No newline at end of file diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index ac8817cb08..37784a20ca 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -75,9 +75,13 @@ scala> var four = "four" four: String = four scala> val four2 = m(four) // should have an existential bound +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details four2: String @Annot(x) forSome { val x: String } = four scala> val four3 = four2 // should have the same type as four2 +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details four3: String @Annot(x) forSome { val x: String } = four scala> val stuff = m("stuff") // should not crash @@ -100,6 +104,8 @@ scala> def m = { val y : String @Annot(x) = x y } // x should not escape the local scope with a narrow type +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details m: String @Annot(x) forSome { val x: String } scala> @@ -113,6 +119,7 @@ scala> def n(y: String) = { } m("stuff".stripMargin) } // x should be existentially bound +warning: there were 1 feature warnings; re-run with -feature for details n: (y: String)String @Annot(x) forSome { val x: String } scala> diff --git a/test/files/run/existentials-in-compiler.check b/test/files/run/existentials-in-compiler.check index 83e3cdf435..4df4b0ca96 100644 --- a/test/files/run/existentials-in-compiler.check +++ b/test/files/run/existentials-in-compiler.check @@ -100,8 +100,8 @@ abstract trait Cov31[+A, +B, C <: (A, B)] extends Object abstract trait Cov32[+A, B, C <: (A, B)] extends Object extest.Cov32[A,B,C] forSome { +A; B; C <: (A, B) } -abstract trait Cov33[+A, -B, C <: (A, _$10) forSome { type _$10 }] extends Object - extest.Cov33[A,B,C] forSome { +A; -B; C <: (A, _$10) forSome { type _$10 } } +abstract trait Cov33[+A, -B, C <: Tuple2[A, _]] extends Object + extest.Cov33[A,B,C] forSome { +A; -B; C <: Tuple2[A, _] } abstract trait Cov34[A, +B, C <: (A, B)] extends Object extest.Cov34[A,B,C] forSome { A; +B; C <: (A, B) } @@ -109,14 +109,14 @@ abstract trait Cov34[A, +B, C <: (A, B)] extends Object abstract trait Cov35[A, B, C <: (A, B)] extends Object extest.Cov35[A,B,C] forSome { A; B; C <: (A, B) } -abstract trait Cov36[A, -B, C <: (A, _$11) forSome { type _$11 }] extends Object - extest.Cov36[A,B,C] forSome { A; -B; C <: (A, _$11) forSome { type _$11 } } +abstract trait Cov36[A, -B, C <: Tuple2[A, _]] extends Object + extest.Cov36[A,B,C] forSome { A; -B; C <: Tuple2[A, _] } -abstract trait Cov37[-A, +B, C <: (_$12, B) forSome { type _$12 }] extends Object - extest.Cov37[A,B,C] forSome { -A; +B; C <: (_$12, B) forSome { type _$12 } } +abstract trait Cov37[-A, +B, C <: Tuple2[_, B]] extends Object + extest.Cov37[A,B,C] forSome { -A; +B; C <: Tuple2[_, B] } -abstract trait Cov38[-A, B, C <: (_$13, B) forSome { type _$13 }] extends Object - extest.Cov38[A,B,C] forSome { -A; B; C <: (_$13, B) forSome { type _$13 } } +abstract trait Cov38[-A, B, C <: Tuple2[_, B]] extends Object + extest.Cov38[A,B,C] forSome { -A; B; C <: Tuple2[_, B] } abstract trait Cov39[-A, -B, C <: Tuple2[_, _]] extends Object extest.Cov39[_, _, _ <: Tuple2[_, _]] diff --git a/test/files/run/macro-reflective-mamd-normal-mi.check b/test/files/run/macro-reflective-mamd-normal-mi.check index ac4213d6e9..e69de29bb2 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi.check +++ b/test/files/run/macro-reflective-mamd-normal-mi.check @@ -1 +0,0 @@ -43
\ No newline at end of file diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 3bc899f49b..9e0f9aa1a2 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,51 +1,54 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import scala.reflect.makro.{Context => Ctx}
-import scala.reflect.makro.{Context=>Ctx}
-
-scala>
-
-scala> object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
- import c.mirror._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
- Expr[Int](body)
- }
-
- def bar(c: Ctx)(x: c.Expr[Int]) = {
- import c.mirror._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
- Expr[Int](body)
- }
-
- def quux(c: Ctx)(x: c.Expr[Int]) = {
- import c.mirror._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
- Expr[Int](body)
- }
-}
-defined module Impls
-
-scala> object Macros {
- object Shmacros {
- def foo(x: Int): Int = macro Impls.foo
- }
- def bar(x: Int): Int = macro Impls.bar
-}; class Macros {
- def quux(x: Int): Int = macro Impls.quux
-}
-defined module Macros
-defined class Macros
-
-scala>
-
-scala> import Macros.Shmacros._
-import Macros.Shmacros._
-
-scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4))
-31
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import language.experimental.macros +import language.experimental.macros + +scala> import scala.reflect.makro.{Context => Ctx} +import scala.reflect.makro.{Context=>Ctx} + +scala> + +scala> object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + Expr[Int](body) + } + + def bar(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + Expr[Int](body) + } + + def quux(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + Expr[Int](body) + } +} +defined module Impls + +scala> object Macros { + object Shmacros { + def foo(x: Int): Int = macro Impls.foo + } + def bar(x: Int): Int = macro Impls.bar +}; class Macros { + def quux(x: Int): Int = macro Impls.quux +} +defined module Macros +defined class Macros + +scala> + +scala> import Macros.Shmacros._ +import Macros.Shmacros._ + +scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +31 + +scala> diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index a21eb7815f..e8849b4b56 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -1,8 +1,8 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Xmacros" def code = """ + |import language.experimental.macros |import scala.reflect.makro.{Context => Ctx} | |object Impls { @@ -36,4 +36,4 @@ object Test extends ReplTest { |import Macros.Shmacros._ |println(foo(2) + Macros.bar(2) * new Macros().quux(4)) |""".stripMargin -}
\ No newline at end of file +} diff --git a/test/files/run/macro-repl-dontexpand.scala b/test/files/run/macro-repl-dontexpand.scala index 9889a8ffdf..cd1b2e1969 100644 --- a/test/files/run/macro-repl-dontexpand.scala +++ b/test/files/run/macro-repl-dontexpand.scala @@ -1,9 +1,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Xmacros" + override def extraSettings = "-language:experimental.macros" def code = """ |def bar(c: scala.reflect.makro.Context) = ??? |def foo = macro bar |""".stripMargin -}
\ No newline at end of file +} diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check index 69f0a9ce30..4b7ce6b059 100644 --- a/test/files/run/repl-parens.check +++ b/test/files/run/repl-parens.check @@ -34,7 +34,7 @@ res7: (Int, Int) = (4,4) scala> (((2 + 2)), ((2 + 2)), 2) res8: (Int, Int, Int) = (4,4,2) -scala> ((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3) mkString) +scala> (((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString) res9: String = 4423 scala> diff --git a/test/files/run/repl-parens.scala b/test/files/run/repl-parens.scala index c1cf9b50e1..e25933b1a2 100644 --- a/test/files/run/repl-parens.scala +++ b/test/files/run/repl-parens.scala @@ -11,7 +11,7 @@ object Test extends ReplTest { 5 ; ( (2 + 2 ) ) ; ((5)) (((2 + 2)), ((2 + 2))) (((2 + 2)), ((2 + 2)), 2) -((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3) mkString) +(((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString) 55 ; ((2 + 2)) ; (1, 2, 3) 55 ; (x: Int) => x + 1 ; () => ((5)) @@ -26,4 +26,4 @@ foo(5)(10)(15)+foo(5)(10)(15) List(1) ++ List('a') """.trim -}
\ No newline at end of file +} diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index b811a4a8c5..e439a2a7f4 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,32 +1,33 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala> :power
-** Power User mode enabled - BEEP WHIR GYVE **
-** :phase has been set to 'typer'. **
-** scala.tools.nsc._ has been imported **
-** global._, definitions._ also imported **
-** Try :help, :vals, power.<tab> **
-
-scala> // guarding against "error: reference to global is ambiguous"
-
-scala> global.emptyValDef // "it is imported twice in the same scope by ..."
-res0: $r.global.emptyValDef.type = private val _ = _
-
-scala> val tp = ArrayClass[scala.util.Random] // magic with manifests
-tp: $r.global.Type = Array[scala.util.Random]
-
-scala> tp.memberType(Array_apply) // evidence
-res1: $r.global.Type = (i: Int)scala.util.Random
-
-scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
-m: $r.treedsl.global.Match =
-10 match {
- case 5 => false
- case _ => true
-}
-
-scala> typed(m).tpe // typed is in scope
-res2: $r.treedsl.global.Type = Boolean
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> // guarding against "error: reference to global is ambiguous" + +scala> global.emptyValDef // "it is imported twice in the same scope by ..." +res0: $r.global.emptyValDef.type = private val _ = _ + +scala> val tp = ArrayClass[scala.util.Random] // magic with manifests +warning: there were 2 feature warnings; re-run with -feature for details +tp: $r.global.Type = Array[scala.util.Random] + +scala> tp.memberType(Array_apply) // evidence +res1: $r.global.Type = (i: Int)scala.util.Random + +scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl +m: $r.treedsl.global.Match = +10 match { + case 5 => false + case _ => true +} + +scala> typed(m).tpe // typed is in scope +res2: $r.treedsl.global.Type = Boolean + +scala> diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index da467e27ea..4598e02d1f 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -4,6 +4,8 @@ Type :help for more information. scala> scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details c: (C, C{def f: Int}) forSome { type C <: Object } = (C,C) scala> diff --git a/test/files/run/t4317/S_1.scala b/test/files/run/t4317/S_1.scala index 2de408268c..2756c879eb 100644 --- a/test/files/run/t4317/S_1.scala +++ b/test/files/run/t4317/S_1.scala @@ -1,3 +1,5 @@ +import language.existentials + object S_1 { def foo1(x: Class[_ <: AnyRef]) = 0 def foo2(x: Class[_ <: AnyRef], y: Int) = 99 diff --git a/test/files/run/t4710.check b/test/files/run/t4710.check index aa2f08d452..7c2b10b098 100644 --- a/test/files/run/t4710.check +++ b/test/files/run/t4710.check @@ -2,6 +2,7 @@ Type in expressions to have them evaluated. Type :help for more information. scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol } +warning: there were 1 feature warnings; re-run with -feature for details method: String scala> |