summaryrefslogtreecommitdiff
path: root/test/files/run/t9349/data.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-01-30 15:55:43 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-02-02 16:16:11 +1000
commitfaa5ae6152b5515fb9980d93b30bd780649ee7fe (patch)
treeb37feba1f4d128334baf646c7a8d0b8e564ba19e /test/files/run/t9349/data.scala
parent8a761a313bfe3d79afefed1622b69a850636d732 (diff)
downloadscala-faa5ae6152b5515fb9980d93b30bd780649ee7fe.tar.gz
scala-faa5ae6152b5515fb9980d93b30bd780649ee7fe.tar.bz2
scala-faa5ae6152b5515fb9980d93b30bd780649ee7fe.zip
SI-9349 Fix use of patmat binder as prefix for new x.Inner
When substituting in references to the synthetic values representing pattern binders, we were replacing: Select(Ident(o).setType(o.type), TypeName("Inner")) with: Select(Ident(x2).setType(typeOf[Outer]), TypeName("Inner")) The post transform in uncurry would then run: else if (tree.isType) TypeTree(tree.tpe) setPos tree.pos Which would loses track of the outer term `o` and crashes the compiler in ExplicitOuter. This commit generates stable references to the binders. I made this change in the substitutions for all `TreeMakers`, however only one of seems like it triggers a crash in the test variations I tried. Here's how the trees for the first pattern in the test case change after this patch: ``` @@ -1,30 +1,30 @@ [[syntax trees at end of patmat]] // test.scala package <empty>{<empty>.type} { object Test extends scala.AnyRef { def <init>(): Test.type = { Test.super{Test.type}.<init>{()Object}(){Object}; (){Unit} }{Unit}; def main(args: Array[String]): Unit = { val o1: Outer = Outer.apply{(i: Int)Outer}(5{Int(5)}){Outer}; { case <synthetic> val x1: Outer = o1{Outer}; case5(){ if (x1.ne{(x$1: AnyRef)Boolean}(null{Null(null)}){Boolean}) matchEnd4{(x: Unit)Unit}({ - val i: Outer#Inner = new x1.Inner{Outer#Inner}{()Outer#Inner}(){Outer#Inner}; + val i: x1.Inner = new x1.Inner{x1.Inner}{()x1.Inner}(){x1.Inner}; (){Unit} }{Unit}){Unit} else case6{()Unit}(){Unit}{Unit} }{Unit}; case6(){ matchEnd4{(x: Unit)Unit}(throw new MatchError{MatchError}{(obj: Any)MatchError}(x1{Outer}){MatchError}{Nothing}){Unit} }{Unit}; matchEnd4(x: Unit){ x{Unit} }{Unit} }{Unit} }{Unit} } ```
Diffstat (limited to 'test/files/run/t9349/data.scala')
-rw-r--r--test/files/run/t9349/data.scala1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/files/run/t9349/data.scala b/test/files/run/t9349/data.scala
new file mode 100644
index 0000000000..f88a6cfaeb
--- /dev/null
+++ b/test/files/run/t9349/data.scala
@@ -0,0 +1 @@
+case class Outer(i: Int) { class Inner }