From ae2ddab00953c44b1d68d2a115303cb195961eea Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 18 Dec 2015 14:05:00 -0800 Subject: [PATCH] Add pending test for #2324 (name hashes of private members) Add a pending test that shows a bug in calculation of name hashes. By design, only non-private members should contribute to name hashes. The test shows that name hashes are calcuclated for strictly private members too. --- .../xsbt/api/NameHashingSpecification.scala | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/compile/api/src/test/scala/xsbt/api/NameHashingSpecification.scala b/compile/api/src/test/scala/xsbt/api/NameHashingSpecification.scala index 6014a1e52..4d3423530 100644 --- a/compile/api/src/test/scala/xsbt/api/NameHashingSpecification.scala +++ b/compile/api/src/test/scala/xsbt/api/NameHashingSpecification.scala @@ -255,7 +255,7 @@ class NameHashingSpecification extends Specification { /** * Checks that private members are NOT included in the hash of the public API of classes. */ - "private members in classes" in { + "private members in classes are not included in the api hash" in { /* class Foo { private val x } */ val classFoo1 = simpleClass("Foo", @@ -273,6 +273,20 @@ class NameHashingSpecification extends Specification { } + /** + * Checks that private members do NOT contribute to name hashes. + * Test for https://github.com/sbt/sbt/issues/2324 + */ + "private members in classes do not contribute to name hashes" in { + /* class Foo { private val x } */ + val classFoo = + simpleClass("Foo", + simpleStructure(new Val(emptyType, "x", privateAccess, defaultModifiers, Array.empty))) + val nameHashes = nameHashesForClass(classFoo) + // make sure there's no name hash for the private member "x" + Seq("Foo") === nameHashes.regularMembers.map(_.name).toSeq + }.pendingUntilFixed("The NameHashing calculates name hashes of all members") + private def assertNameHashEqualForRegularName(name: String, nameHashes1: _internalOnly_NameHashes, nameHashes2: _internalOnly_NameHashes) = { val nameHash1 = nameHashForRegularName(nameHashes1, name)