aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/pos/t5720-ownerous.scala
diff options
context:
space:
mode:
authorSamuel Gruetter <samuel.gruetter@epfl.ch>2014-12-16 16:38:09 +0100
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-12-16 16:38:09 +0100
commit42851ed2675015d42bb341b82a09bd0bef4a8ce4 (patch)
tree06806b4183cf74a43553e9a8a9acfeff84fdf712 /tests/pending/pos/t5720-ownerous.scala
parent5be609fc4e04e3cca5e1435ee41b8cacac9b0513 (diff)
downloaddotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.tar.gz
dotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.tar.bz2
dotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.zip
move failing tests from tests/untried/pos to tests/pending/pos
Diffstat (limited to 'tests/pending/pos/t5720-ownerous.scala')
-rw-r--r--tests/pending/pos/t5720-ownerous.scala56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/pending/pos/t5720-ownerous.scala b/tests/pending/pos/t5720-ownerous.scala
new file mode 100644
index 000000000..e171ce9c2
--- /dev/null
+++ b/tests/pending/pos/t5720-ownerous.scala
@@ -0,0 +1,56 @@
+
+/*
+ * The block under qual$1 must be owned by it.
+ * In the sample bug, the first default arg generates x$4,
+ * the second default arg generates qual$1, hence the maximal
+ * minimization.
+ *
+ <method> <triedcooking> def model: C.this.M = {
+ val qual$1: C.this.M = scala.Option.apply[C.this.M]({
+ val x$1: lang.this.String("foo") = "foo";
+ val x$2: String = C.this.M.apply$default$2("foo");
+ C.this.M.apply("foo")(x$2)
+}).getOrElse[C.this.M]({
+ val x$3: lang.this.String("bar") = "bar";
+ val x$4: String = C.this.M.apply$default$2("bar");
+ C.this.M.apply("bar")(x$4)
+ });
+ val x$5: lang.this.String("baz") = "baz";
+ val x$6: String = qual$1.copy$default$2("baz");
+ qual$1.copy("baz")(x$6)
+ }
+ */
+class C {
+ case class M(currentUser: String = "anon")(val message: String = "empty")
+ val m = M("foo")()
+
+ // reported
+ //def model = Option(M("foo")()).getOrElse(M("bar")()).copy(currentUser = "")()
+
+ // the bug
+ def model = Option(m).getOrElse(M("bar")()).copy("baz")("empty")
+
+ // style points for this version
+ def modish = ((null: Option[M]) getOrElse new M()()).copy()("empty")
+
+ // various simplifications are too simple
+ case class N(currentUser: String = "anon")
+ val n = N("fun")
+ def nudel = Option(n).getOrElse(N()).copy()
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val c = new C
+ println(c.model.currentUser)
+ println(c.model.message)
+ }
+}
+/*
+symbol value x$4$1 does not exist in badcopy.C.model
+at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45)
+at scala.tools.nsc.Global.abort(Global.scala:202)
+at scala.tools.nsc.backend.icode.GenICode$ICodePhase.liftedTree2$1(GenICode.scala:998)
+at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:992)
+*/
+