diff options
author | Paul Phillips <paulp@improving.org> | 2011-04-05 01:48:31 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-04-05 01:48:31 +0000 |
commit | e50fbcc3b32d4d65deb98a06c644894d3561c81c (patch) | |
tree | 182009f58959df2f676a73c9bb33fc18bbfcead2 /test | |
parent | e06244cb55797d9928a52a22a548d547555be733 (diff) | |
download | scala-e50fbcc3b32d4d65deb98a06c644894d3561c81c.tar.gz scala-e50fbcc3b32d4d65deb98a06c644894d3561c81c.tar.bz2 scala-e50fbcc3b32d4d65deb98a06c644894d3561c81c.zip |
Enhancing the repl-testing code by turning it i...
Enhancing the repl-testing code by turning it into a transcript
producing machine. "Here's some code." "Here's a transcript!" "Good day
to you, sir!" "No, good day to YOU!"
These changes are awesome. Look at the checkfile diffs for god's sake,
they'll make you weep with joy. No review.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/interpreter.check | 339 | ||||
-rw-r--r-- | test/files/run/bug3376.check | 13 | ||||
-rw-r--r-- | test/files/run/bug4285.check | 11 | ||||
-rw-r--r-- | test/files/run/constrained-types.check | 132 | ||||
-rw-r--r-- | test/files/run/constrained-types.scala | 146 | ||||
-rw-r--r-- | test/files/run/repl-assign.check | 14 | ||||
-rw-r--r-- | test/files/run/repl-paste-2.check | 26 | ||||
-rw-r--r-- | test/files/run/repl-paste.check | 16 | ||||
-rw-r--r-- | test/files/run/repl-transcript.check | 17 |
9 files changed, 464 insertions, 250 deletions
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 3c0ee7b4bd..dd0f39551c 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -2,222 +2,360 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> -scala> res0: Int = 7 -scala> | | | | gcd: (x: Int,y: Int)Int +scala> // basics + +scala> 3+4 +res0: Int = 7 -scala> five: Int = 5 +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> x: Int = 1 +scala> val five = gcd(15,35) +five: Int = 5 -scala> x: Int = 2 +scala> var x = 1 +x: Int = 1 -scala> three: Int = 3 +scala> x = 2 +x: Int = 2 -scala> defined type alias anotherint +scala> val three = x+1 +three: Int = 3 -scala> four: anotherint = 4 +scala> type anotherint = Int +defined type alias anotherint -scala> <console>:8: error: type mismatch; +scala> val four: anotherint = 4 +four: anotherint = 4 + +scala> val bogus: anotherint = "hello" +<console>:8: error: type mismatch; found : java.lang.String("hello") required: anotherint val bogus: anotherint = "hello" ^ -scala> defined trait PointlessTrait +scala> trait PointlessTrait +defined trait PointlessTrait -scala> x: Int = 2 +scala> val (x,y) = (2,3) +x: Int = 2 y: Int = 3 -scala> hello +scala> println("hello") +hello scala> -scala> -scala> t1513: Array[Null] = Array(null) -scala> -scala> atom: scala.xml.Atom[Unit] = () +scala> // ticket #1513 -scala> -scala> defined class S +scala> val t1513 = Array(null) +t1513: Array[Null] = Array(null) -scala> fish: S = fish +scala> // ambiguous toString problem from #547 -scala> -scala> arr: Array[java.lang.String] = Array(What's, up, doc?) +scala> val atom = new scala.xml.Atom() +atom: scala.xml.Atom[Unit] = () -scala> -scala> arrInt: Any = Array(1, 2, 3) +scala> // overriding toString problem from #1404 -scala> -scala> arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) +scala> class S(override val toString : String) +defined class S -scala> -scala> -scala> defined class Foo +scala> val fish = new S("fish") +fish: S = fish -scala> defined class Bar +scala> // Test that arrays pretty print nicely. -scala> foo2bar: (foo: Foo)Bar +scala> val arr = Array("What's", "up", "doc?") +arr: Array[java.lang.String] = Array(What's, up, doc?) -scala> bar: Bar = Bar(3) +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> m: Int = 3 +scala> val m = n +m: Int = 3 scala> -scala> -scala> one: Int = 1 -scala> one: Int = 1 +scala> // stressing the imports mechanism -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> one: Int = 1 +scala> val one = 1 +one: Int = 1 -scala> 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> x1: Int = 1 -scala> x2: Int = 1 +scala> val x1 = 1 +x1: Int = 1 -scala> x3: Int = 1 +scala> val x2 = 1 +x2: Int = 1 -scala> x4: Int = 1 +scala> val x3 = 1 +x3: Int = 1 -scala> x5: Int = 1 +scala> val x4 = 1 +x4: Int = 1 -scala> x6: Int = 1 +scala> val x5 = 1 +x5: Int = 1 -scala> x7: Int = 1 +scala> val x6 = 1 +x6: Int = 1 -scala> x8: Int = 1 +scala> val x7 = 1 +x7: Int = 1 -scala> x9: Int = 1 +scala> val x8 = 1 +x8: Int = 1 -scala> x10: Int = 1 +scala> val x9 = 1 +x9: Int = 1 -scala> x11: Int = 1 +scala> val x10 = 1 +x10: Int = 1 -scala> x12: Int = 1 +scala> val x11 = 1 +x11: Int = 1 -scala> x13: Int = 1 +scala> val x12 = 1 +x12: Int = 1 -scala> x14: Int = 1 +scala> val x13 = 1 +x13: Int = 1 -scala> x15: Int = 1 +scala> val x14 = 1 +x14: Int = 1 -scala> x16: Int = 1 +scala> val x15 = 1 +x15: Int = 1 -scala> x17: Int = 1 +scala> val x16 = 1 +x16: Int = 1 -scala> x18: Int = 1 +scala> val x17 = 1 +x17: Int = 1 -scala> x19: Int = 1 +scala> val x18 = 1 +x18: Int = 1 -scala> x20: Int = 1 +scala> val x19 = 1 +x19: Int = 1 -scala> -scala> two: Int = 2 +scala> val x20 = 1 +x20: Int = 1 scala> + +scala> val two = one + x5 +two: Int = 2 + scala> -scala> -scala> xs: Array[_] = Array(1, 2) -scala> res2: Int = 2 +scala> // handling generic wildcard arrays (#2386) -scala> res3: Any = 1 +scala> // It's put here because type feedback is an important part of it. -scala> res4: Array[_] = Array(2) +scala> val xs: Array[_] = Array(1, 2) +xs: Array[_] = Array(1, 2) -scala> res5: Array[java.lang.String] = Array(abc, abc) +scala> xs.size +res2: Int = 2 -scala> res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2) +scala> xs.head +res3: Any = 1 -scala> res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) +scala> xs filter (_ == 2) +res4: Array[_] = Array(2) + +scala> xs map (_ => "abc") +res5: Array[java.lang.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> -scala> -scala> <console>:1: error: '=' expected but '=>' found. + +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> <console>:1: error: illegal start of definition +scala> [1,2,3] +<console>:1: error: illegal start of definition [1,2,3] ^ scala> + scala> -scala> -scala> | | | | res8: scala.xml.Elem = + +scala> // multi-line XML + +scala> <a> +<b + c="c" + d="dd" +/></a> +res8: scala.xml.Elem = <a> <b c="c" d="dd"></b></a> scala> + scala> -scala> | | | | -scala> + +scala> /* + /* + multi-line comment + */ +*/ + scala> + scala> -scala> | | | res9: java.lang.String = + +scala> // multi-line string + +scala> """ +hello +there +""" +res9: java.lang.String = " hello there " scala> -scala> | | You typed two blank lines. Starting a new command. -scala> -scala> match: Int +scala> (1 + // give up early by typing two blank lines -scala> x: Int = 1 + +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> -scala> defined class Exp + +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> | | <console>:18: warning: match is not exhaustive! +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 @@ -226,6 +364,7 @@ missing combination Term f: (e: Exp)Int scala> + scala> plusOne: (x: Int)Int res0: Int = 6 diff --git a/test/files/run/bug3376.check b/test/files/run/bug3376.check index 7286096022..3a1d7d581b 100644 --- a/test/files/run/bug3376.check +++ b/test/files/run/bug3376.check @@ -2,12 +2,17 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> defined class M -scala> m1: M[Int] = mmm +scala> class M[@specialized T] { override def toString = "mmm" } +defined class M -scala> m2: M[Float] = mmm +scala> val m1 = new M[Int]() +m1: M[Int] = mmm -scala> m3: M[String] = mmm +scala> val m2 = new M[Float]() +m2: M[Float] = mmm + +scala> val m3 = new M[String]() +m3: M[String] = mmm scala> diff --git a/test/files/run/bug4285.check b/test/files/run/bug4285.check index 5a3c9811c3..84f8929e43 100644 --- a/test/files/run/bug4285.check +++ b/test/files/run/bug4285.check @@ -2,11 +2,16 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) -scala> y: scala.collection.mutable.WrappedArray[Int] = WrappedArray(2, 4, 6, 8, 10, 12, 14) +scala> val x = Array(1,2,3,4,5,6,7) +x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) -scala> 56 +scala> val y = x transform (_ * 2) +y: scala.collection.mutable.WrappedArray[Int] = WrappedArray(2, 4, 6, 8, 10, 12, 14) + +scala> println(y.sum) +56 scala> + scala> diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index e22e3a58d5..6919eca9bc 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -1,102 +1,110 @@ -class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> + +scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint defined class Annot ------ -class A { +scala> + +scala> class A { val x = "hello" val y: Int @Annot(x) = 10 override def toString = "an A" } defined class A ------ -val a = new A +scala> + +scala> val a = new A a: A = an A ------ -val y = a.y // should rewrite "this.x" to "a.x" +scala> val y = a.y // should rewrite "this.x" to "a.x" y: Int @Annot(a.x) = 10 ------ -var a2 = new A +scala> var a2 = new A a2: A = an A ------ -val y2 = a2.y // should drop the annotation +scala> val y2 = a2.y // should drop the annotation y2: Int = 10 ------ -object Stuff { +scala> + +scala> object Stuff { val x = "hello" val y : Int @Annot(x) = 10 } defined module Stuff ------ -val y = Stuff.y // should rewrite the annotation +scala> + +scala> val y = Stuff.y // should rewrite the annotation y: Int @Annot(Stuff.x) = 10 ------ -class B { +scala> + +scala> class B { val y: Int @Annot(Stuff.x) = 10 override def toString = "a B" } defined class B ------ -val b = new B +scala> + +scala> val b = new B b: B = a B ------ -val y = b.y // should keep the annotation +scala> val y = b.y // should keep the annotation y: Int @Annot(Stuff.x) = 10 ------ -def m(x: String): String @Annot(x) = x +scala> def m(x: String): String @Annot(x) = x m: (x: String)String @Annot(x) ------ -val three = "three" +scala> + +scala> val three = "three" three: java.lang.String = three ------ -val three2 = m(three:three.type) // should change x to three +scala> val three2 = m(three:three.type) // should change x to three three2: String @Annot(three) = three ------ -var four = "four" +scala> var four = "four" four: java.lang.String = four ------ -val four2 = m(four) // should have an existential bound +scala> val four2 = m(four) // should have an existential bound four2: java.lang.String @Annot(x) forSome { val x: java.lang.String } = four ------ -val four3 = four2 // should have the same type as four2 +scala> val four3 = four2 // should have the same type as four2 four3: java.lang.String @Annot(x) forSome { val x: java.lang.String } = four ------ -val stuff = m("stuff") // should not crash +scala> val stuff = m("stuff") // should not crash stuff: String @Annot("stuff") = stuff ------ -class peer extends annotation.Annotation // should not crash +scala> + +scala> class peer extends annotation.Annotation // should not crash defined class peer ------ -class NPE[T <: NPE[T] @peer] // should not crash +scala> + +scala> class NPE[T <: NPE[T] @peer] // should not crash defined class NPE ------ -def m = { +scala> + +scala> def m = { val x = "three" val y : String @Annot(x) = x y } // x should not escape the local scope with a narrow type m: String @Annot("three") ------ -def n(y: String) = { +scala> + +scala> def n(y: String) = { def m(x: String) : String @Annot(x) = { (if (x == "") m("default") @@ -107,30 +115,40 @@ def n(y: String) = { } // x should be existentially bound n: (y: String)java.lang.String @Annot(x) forSome { val x: String } ------ -class rep extends annotation.Annotation +scala> + +scala> class rep extends annotation.Annotation { } defined class rep ------ -object A { val x = "hello" : String @ rep } +scala> + +scala> object A { val x = "hello" : String @ rep } defined module A +warning: previously defined class A is not a companion to object A. +Companions must be defined together; you may wish to use :paste mode for this. ------ -val y = a.x // should drop the annotation +scala> + +scala> val y = a.x // should drop the annotation y: java.lang.String = hello ------ -val x = 3 : Int @Annot(e+f+g+h) //should have a graceful error message +scala> + +scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message <console>:8: error: not found: value e - val x = 3 : Int @Annot(e+f+g+h) //should have a graceful error message + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ ------ -class Where(condition: Boolean) extends annotation.Annotation +scala> + +scala> class Where(condition: Boolean) extends annotation.Annotation defined class Where ------ -val x : Int @Where(self > 0 && self < 100) = 3 +scala> + +scala> val x : Int @Where(self > 0 && self < 100) = 3 x: Int @Where(self.>(0).&&(self.<(100))) = 3 ------ +scala> + +scala> diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala index 86fcaade6e..5f7eb7adde 100644 --- a/test/files/run/constrained-types.scala +++ b/test/files/run/constrained-types.scala @@ -3,103 +3,91 @@ * of DeBruijn's . It runs the test using the interpreter so that * the resulting annotated types can be printed out. */ -import scala.tools.nsc._ -import java.io._ -import scala.Console +import scala.tools.nsc.Settings +import scala.tools.partest.ReplTest -object Test { +object Test extends ReplTest { + def code = """ - val testCode = List( - "class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint", +class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint - """class A { - | val x = "hello" - | val y: Int @Annot(x) = 10 - | override def toString = "an A" - |} """, - - - - "val a = new A", - - """val y = a.y // should rewrite "this.x" to "a.x" """, - - - "var a2 = new A", - "val y2 = a2.y // should drop the annotation", - - - """object Stuff { - | val x = "hello" - | val y : Int @Annot(x) = 10 - |}""", - - "val y = Stuff.y // should rewrite the annotation", +class A { + val x = "hello" + val y: Int @Annot(x) = 10 + override def toString = "an A" +} - """class B { - | val y: Int @Annot(Stuff.x) = 10 - | override def toString = "a B" - |}""", +val a = new A +val y = a.y // should rewrite "this.x" to "a.x" +var a2 = new A +val y2 = a2.y // should drop the annotation - "val b = new B", - "val y = b.y // should keep the annotation", +object Stuff { + val x = "hello" + val y : Int @Annot(x) = 10 +} +val y = Stuff.y // should rewrite the annotation - "def m(x: String): String @Annot(x) = x", - "val three = \"three\"", - "val three2 = m(three:three.type) // should change x to three", - "var four = \"four\"", - "val four2 = m(four) // should have an existential bound", - "val four3 = four2 // should have the same type as four2", +class B { + val y: Int @Annot(Stuff.x) = 10 + override def toString = "a B" +} - """val stuff = m("stuff") // should not crash""", +val b = new B +val y = b.y // should keep the annotation +def m(x: String): String @Annot(x) = x + +val three = "three" +val three2 = m(three:three.type) // should change x to three +var four = "four" +val four2 = m(four) // should have an existential bound +val four3 = four2 // should have the same type as four2 +val stuff = m("stuff") // should not crash + +class peer extends annotation.Annotation // should not crash + +class NPE[T <: NPE[T] @peer] // should not crash + +def m = { + val x = "three" + val y : String @Annot(x) = x + y +} // x should not escape the local scope with a narrow type + +def n(y: String) = { + def m(x: String) : String @Annot(x) = { + (if (x == "") + m("default") + else + x) + } + m("stuff".stripMargin) +} // x should be existentially bound - """class peer extends annotation.Annotation // should not crash""", // reported by Manfred Stock - """class NPE[T <: NPE[T] @peer] // should not crash""", // reported by Manfred Stock +class rep extends annotation.Annotation { } - """def m = { - | val x = "three" - | val y : String @Annot(x) = x - | y - |} // x should not escape the local scope with a narrow type""", +object A { val x = "hello" : String @ rep } - """def n(y: String) = { - | def m(x: String) : String @Annot(x) = { - | (if (x == "") - | m("default") - | else - | x) - | } - | m("stuff".stripMargin) - |} // x should be existentially bound""", +val y = a.x // should drop the annotation - "class rep extends annotation.Annotation", - """object A { val x = "hello" : String @ rep }""", - "val y = a.x // should drop the annotation", +val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message - "val x = 3 : Int @Annot(e+f+g+h) //should have a graceful error message", +class Where(condition: Boolean) extends annotation.Annotation - "class Where(condition: Boolean) extends annotation.Annotation", - "val x : Int @Where(self > 0 && self < 100) = 3" - ).map(_.stripMargin) +val x : Int @Where(self > 0 && self < 100) = 3 +""" + override def settings: Settings = { + val s = new Settings - def main(args: Array[String]) { - val settings = new Settings - settings.Xexperimental.value = true - settings.selfInAnnots.value = true - settings.deprecation.value = true + s.Xexperimental.value = true + s.selfInAnnots.value = true + s.deprecation.value = true // when running that compiler, give it a scala-library to the classpath - settings.classpath.value = System.getProperty("java.class.path") - - val interp = new Interpreter(settings) + s.classpath.value = sys.props("java.class.path") - for (cmd <- testCode) { - println(cmd) - interp.interpret(cmd) - println() - println("-----") - } + s } } diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check index 0181985f08..c6b0458f04 100644 --- a/test/files/run/repl-assign.check +++ b/test/files/run/repl-assign.check @@ -2,13 +2,19 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> x: Int = 10 -scala> y: Int = 11 +scala> var x = 10 +x: Int = 10 -scala> x: Int = 12 +scala> var y = 11 +y: Int = 11 -scala> y: Int = 13 +scala> x = 12 +x: Int = 12 + +scala> y = 13 +y: Int = 13 scala> + scala> diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index fb7a818f1a..684f20e1d2 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -2,7 +2,31 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> // Replaying 7 commands from transcript. + +scala> scala> 123 +res0: Int = 123 + +scala> 567 +res1: Int = 567 + +scala> res0 + res1 +res2: Int = 690 + +scala> val x = dingus +<console>:7: error: not found: value dingus + val x = dingus + ^ + +scala> val x = "dingus" +x: java.lang.String = dingus + +scala> x.length +res3: Int = 6 + +scala> x.length + res3 +res4: Int = 12 + +// Replaying 7 commands from transcript. val res0 = { 123 } res0: Int = 123 diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index 4c9de85e67..50589433cd 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -1,7 +1,21 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> // Entering paste mode (ctrl-D to finish) +scala> :paste +// Entering paste mode (ctrl-D to finish) + + + class Dingus + { + private val x = 5 + def y = Dingus.x * 2 + } + object Dingus + { + private val x = 55 + } + + val x = (new Dingus).y // Exiting paste mode, now interpreting. diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check index b2a8d2e156..c6563c67a9 100644 --- a/test/files/run/repl-transcript.check +++ b/test/files/run/repl-transcript.check @@ -2,7 +2,22 @@ Type in expressions to have them evaluated. Type :help for more information. scala> -scala> // Replaying 5 commands from transcript. + +scala> scala> class Bippity +defined class Bippity + +scala> def f = new Bippity +f: Bippity + +scala> 123 +res5: Int = 123 + +scala> 1 to 100 map (_ + 1) +res6: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101) + +scala> res6.sum + res5 + +// Replaying 5 commands from transcript. class Bippity defined class Bippity |