bazel syntax: remove deprecated list constructors
- rename Sequence.createImmutable to StarlarkList.immutableCopyOf
- delete StarlarkList.of(StarlarkThread, ...)
and StarlarkList.copyOf(StarlarkThread, ...)
Mutability is now always an explicit parameter.
StarlarkThread is no longer relevant to StarlarkList
- deprecate Dict constructors that take a StarlarkThread,
and provide (only a few) Mutability variants.
This CL makes only the minimum change to Dict to support
the changes to StarlarkList. A follow-up CL will
eliminate the deprecated constructors. In some cases
"(Mutability) null" is required to avoid overload ambiguity.
This is a breaking change for copybara.
BEGIN_PUBLIC
bazel syntax: remove deprecated list constructors
END_PUBLIC
PiperOrigin-RevId: 281805867
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
index 6b8bb04..0ecc3cf 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
@@ -1084,7 +1084,7 @@
" modified_list = v + ['extra_string']",
" return modified_list",
"m = func(mock)")
- .testLookup("m", StarlarkList.of(thread, "b", "c", "extra_string"));
+ .testLookup("m", StarlarkList.of(thread.mutability(), "b", "c", "extra_string"));
}
@Test
@@ -1555,7 +1555,7 @@
" return value",
"",
"f()[1] += 1") // `f()` should be called only once here
- .testLookup("counter", StarlarkList.of(thread, 1));
+ .testLookup("counter", StarlarkList.of(thread.mutability(), 1));
// Check key position.
new SkylarkTest()
@@ -1568,7 +1568,7 @@
" return 1",
"",
"value[f()] += 1") // `f()` should be called only once here
- .testLookup("counter", StarlarkList.of(thread, 1));
+ .testLookup("counter", StarlarkList.of(thread.mutability(), 1));
}
@Test
@@ -1608,8 +1608,9 @@
"",
"f(ordinary)[0] = g(ordinary)[1]",
"f(augmented)[0] += g(augmented)[1]")
- .testLookup("ordinary", StarlarkList.of(thread, "g", "f")) // This order is consistent
- .testLookup("augmented", StarlarkList.of(thread, "f", "g")); // with Python
+ .testLookup(
+ "ordinary", StarlarkList.of(thread.mutability(), "g", "f")) // This order is consistent
+ .testLookup("augmented", StarlarkList.of(thread.mutability(), "f", "g")); // with Python
}
@Test
@@ -1741,7 +1742,7 @@
public void testDictAssignmentAsLValueSideEffects() throws Exception {
new SkylarkTest()
.setUp("def func(d):", " d['b'] = 2", "d = {'a' : 1}", "func(d)")
- .testLookup("d", Dict.of(null, "a", 1, "b", 2));
+ .testLookup("d", Dict.of((Mutability) null, "a", 1, "b", 2));
}
@Test