From ff2cd805111b4fcd39ce7fb1f4bd0268a50faeee Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 10 Nov 2014 23:48:55 +1000 Subject: SI-8944 A more resiliant naming scheme for case accessors Case class parameters that are less that public have an extra accessor method created to ensure universal pattern matchability. See #4081 for more background. Currently, this is given a fresh name based on the parameter name. However, this is fragile and the name can change based on unrelated edits higher up in the source file. This commit switches to a stable naming scheme for these methods. A non-public case field `foo` has a corresponding accessor `foo$access$N`, where `N` is the index of the parameter within the constructor parameter list. The enclosed tests show a case that used to trigger a linkage error under separate compilation that now works; shows that by choosing the `foo$access$1` rather than `foo$1` we don't clash with lambda lifted methods in the class; and shows the names of the accessor methods as seen via Java reflection. --- test/files/run/t8944c.check | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/files/run/t8944c.check (limited to 'test/files/run/t8944c.check') diff --git a/test/files/run/t8944c.check b/test/files/run/t8944c.check new file mode 100644 index 0000000000..7738f76980 --- /dev/null +++ b/test/files/run/t8944c.check @@ -0,0 +1,5 @@ +private java.lang.Object Foo.ant() +public java.lang.Object Foo.ant$access$0() +private scala.collection.Seq Foo.cat() +public scala.collection.Seq Foo.cat$access$2() +public java.lang.Object Foo.elk() -- cgit v1.2.3