diff options
author | Som Snytt <som.snytt@gmail.com> | 2013-11-10 16:26:59 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2013-11-10 23:22:49 -0800 |
commit | 1d3156ca5dc07470212afa016b3ad17b02c27a99 (patch) | |
tree | ee1a25d1cc1f9cfb6193074ca561d61c9a187a4b /test/files | |
parent | 1f834cdc9be78c2a6850044a9db24d461b5151ec (diff) | |
download | scala-1d3156ca5dc07470212afa016b3ad17b02c27a99.tar.gz scala-1d3156ca5dc07470212afa016b3ad17b02c27a99.tar.bz2 scala-1d3156ca5dc07470212afa016b3ad17b02c27a99.zip |
SI-7747 Support class based wrappers clean up
Simplified the code paths to just use one of two `Wrapper` types
for textual templating.
Simplified the class-based template to use the same `$iw` name
for the both the class and the wrapper value. In addition,
the $read value is an object extending $read, instead of containing
an extra instance field, which keeps paths to values the same
for both templates.
Both styles trigger loading the value object by referencing the
value that immediately wraps the user code, although for the
class style, inner vals are eager and it would suffice to load
the enclosing `$read` object.
The proposed template included extra vals for values imported
from history, but this is not necessary since such an import
is always a stable path. (Or, counter-example to test is welcome.)
The test for t5148 is updated as a side effect. Probably internal
APIs don't make good test subjects.
Modify -Y option message.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t5148.check | 8 | ||||
-rw-r--r-- | test/files/run/t7747-repl.check | 37 |
2 files changed, 18 insertions, 27 deletions
diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check index 25107c4dbe..f426bd2010 100644 --- a/test/files/neg/t5148.check +++ b/test/files/neg/t5148.check @@ -1,9 +1,5 @@ -error: bad symbolic reference. A signature in Imports.class refers to term global +error: bad symbolic reference. A signature in Imports.class refers to type Request in class scala.tools.nsc.interpreter.IMain which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling Imports.class. -error: bad symbolic reference. A signature in Imports.class refers to term memberHandlers -in class scala.tools.nsc.interpreter.IMain which is not available. -It may be completely missing from the current classpath, or the version on -the classpath might be incompatible with the version used when compiling Imports.class. -two errors found +one error found diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check index ae7ea67e61..ad924f482c 100644 --- a/test/files/run/t7747-repl.check +++ b/test/files/run/t7747-repl.check @@ -57,15 +57,10 @@ defined class Ruminant res3: Int = 216 scala> Bovine.x = List(Ruminant(5), Cow, new Moo) -<console>:8: error: $VAL10 is already defined as value $VAL10 -val $VAL10 = INSTANCE; - ^ -<console>:12: error: $VAL11 is already defined as value $VAL11 -val $VAL11 = INSTANCE; - ^ +Bovine.x: List[Any] = List(Ruminant(5), Cow, Moooooo) scala> Bovine.x -res4: List[Any] = null +res4: List[Any] = List(Ruminant(5), Cow, Moooooo) scala> @@ -117,7 +112,7 @@ scala> 55 ; ((2 + 2)) ; (1, 2, 3) res15: (Int, Int, Int) = (1,2,3) scala> 55 ; (x: Int) => x + 1 ; () => ((5)) -<console>:9: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses +<console>:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses 55 ; (x: Int) => x + 1 ;; ^ res16: () => Int = <function0> @@ -185,6 +180,7 @@ val z = x * y 2 + 3 } ; bippy+88+11 object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy +Bovine.x = List(Ruminant(5), Cow, new Moo) Bovine.x (2) (2 + 2) @@ -257,34 +253,33 @@ class $read extends Serializable { super.<init>; () }; - class $iwC extends Serializable { + class $iw extends Serializable { def <init>() = { super.<init>; () }; - val $VAL44 = $line44.$read.INSTANCE; - import $VAL44.$iw.$iw.BippyBups; - val $VAL45 = $line45.$read.INSTANCE; - import $VAL45.$iw.$iw.PuppyPups; - val $VAL46 = $line46.$read.INSTANCE; - import $VAL46.$iw.$iw.Bingo; - class $iwC extends Serializable { + import $line44.$read.$iw.$iw.BippyBups; + import $line44.$read.$iw.$iw.BippyBups; + import $line45.$read.$iw.$iw.PuppyPups; + import $line45.$read.$iw.$iw.PuppyPups; + import $line46.$read.$iw.$iw.Bingo; + import $line46.$read.$iw.$iw.Bingo; + class $iw extends Serializable { def <init>() = { super.<init>; () }; val res3 = List(BippyBups, PuppyPups, Bingo) }; - val $iw = new $iwC.<init> + val $iw = new $iw.<init> }; - val $iw = new $iwC.<init> + val $iw = new $iw.<init> } -object $read extends scala.AnyRef { +object $read extends $read { def <init>() = { super.<init>; () - }; - val INSTANCE = new $read.<init> + } } res3: List[Product with Serializable] = List(BippyBups(), PuppyPups(), Bingo()) |