Unify Skylark and BUILD lists
Use SkylarkList everywhere rather than either List or GlobList.
Keep a GlobList underneath a MutableList, where applicable.
--
MOS_MIGRATED_REVID=105864035
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
index 7c0828b..86e8d8f 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
@@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
+import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Before;
@@ -27,8 +28,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.Arrays;
-
/**
* Tests for MethodLibrary.
*/
@@ -915,9 +914,9 @@
@Test
public void testEnumerateBadArg() throws Exception {
- // TODO(bazel-team): unify BUILD List and Skylark list, and get rid of this ugly message.
new BothModesTest().testIfErrorContains(
- "expected List or sequence for 'list' while calling enumerate but got string instead: a",
+ "Method enumerate(list: sequence) is not applicable for arguments (string): "
+ + "'list' is string, but should be sequence",
"enumerate('a')");
}
@@ -925,18 +924,18 @@
public void testPyListAppend() throws Exception {
new BuildTest()
.setUp("FOO = ['a', 'b']", "FOO.append('c')")
- .testLookup("FOO", Arrays.asList("a", "b", "c"))
+ .testLookup("FOO", MutableList.of(env, "a", "b", "c"))
.testIfErrorContains(
- "function 'append' is not defined on object of type 'Tuple'", "(1, 2).append(3)");
+ "function append is not defined on object of type 'tuple'", "(1, 2).append(3)");
}
@Test
public void testPyListExtend() throws Exception {
new BuildTest()
.setUp("FOO = ['a', 'b']", "FOO.extend(['c', 'd'])")
- .testLookup("FOO", Arrays.asList("a", "b", "c", "d"))
+ .testLookup("FOO", MutableList.of(env, "a", "b", "c", "d"))
.testIfErrorContains(
- "function 'extend' is not defined on object of type 'Tuple'", "(1, 2).extend([3, 4])");
+ "function extend is not defined on object of type 'tuple'", "(1, 2).extend([3, 4])");
}
@Test
@@ -944,7 +943,7 @@
new BuildTest()
.setUp("cc_binary = (['hello.cc'])")
.testIfErrorContains(
- "'List' object is not callable",
+ "'list' object is not callable",
"cc_binary(name = 'hello', srcs=['hello.cc'], malloc = '//base:system_malloc')");
}