Let select concatenation mix Skylark and native lists
(e.g. select({...}) + [list1] + [list2] where list1 is
defined in a BUILD file and list2 is defined in
a Skylark macro/rule).
Fixes #176
--
MOS_MIGRATED_REVID=93633255
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
index 5c7715f..9d83155 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
@@ -465,6 +465,16 @@
"(1, 2) + [3, 4]");
}
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testSelectorListConcatenation() throws Exception {
+ SelectorList x = (SelectorList) eval("select({'foo': ['FOO'], 'bar': ['BAR']}) + []");
+ List<Object> elements = x.getElements();
+ assertThat(elements.size()).isEqualTo(2);
+ assertThat(elements.get(0)).isInstanceOf(SelectorValue.class);
+ assertThat((Iterable) elements.get(1)).isEmpty();
+ }
+
@Test
public void testListComprehensionFailsOnNonSequence() throws Exception {
checkEvalErrorContains("type 'int' is not iterable", "[x + 1 for x in 123]");