bazel syntax: rename UserDefinedFunction to StarlarkFunction
This CL is a pure renaming.
PiperOrigin-RevId: 265911662
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index fc9c05f..41235cd 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -136,7 +136,7 @@
return ((SkylarkRuleFunction) lookup(name)).getRuleClass();
}
- private void registerDummyUserDefinedFunction() throws Exception {
+ private void registerDummyStarlarkFunction() throws Exception {
eval("def impl():", " pass");
}
@@ -776,7 +776,7 @@
@Test
public void testRuleUnknownKeyword() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
checkErrorContains(
"unexpected keyword 'bad_keyword', for call to function rule(",
"rule(impl, bad_keyword = 'some text')");
@@ -791,7 +791,7 @@
@Test
public void testRuleBadTypeForAdd() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
checkErrorContains(
"expected value of type 'dict or NoneType' for parameter 'attrs', "
+ "for call to function rule(",
@@ -800,7 +800,7 @@
@Test
public void testRuleBadTypeInAdd() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
checkErrorContains(
"expected <String, Descriptor> type for 'attrs' but got <string, string> instead",
"rule(impl, attrs = {'a1': 'some text'})");
@@ -808,7 +808,7 @@
@Test
public void testRuleBadTypeForDoc() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
checkErrorContains(
"expected value of type 'string' for parameter 'doc', for call to function rule(",
"rule(impl, doc = 1)");
@@ -1575,7 +1575,7 @@
@Test
public void aspectBadTypeForDoc() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
checkErrorContains(
"expected value of type 'string' for parameter 'doc', for call to function aspect(",
"aspect(impl, doc = 1)");
@@ -1737,7 +1737,7 @@
@Test
public void testRuleAddExecutionConstraints() throws Exception {
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')");
evalAndExport(
"r1 = rule(",
@@ -1759,7 +1759,7 @@
ev = createEvaluationTestCase(semantics);
ev.initialize();
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')");
evalAndExport(
"r1 = rule(impl, ",
@@ -1780,7 +1780,7 @@
ev = createEvaluationTestCase(semantics);
ev.initialize();
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')");
evalAndExport(
"r1 = rule(impl, ",
@@ -1802,7 +1802,7 @@
ev.setFailFast(false);
ev.initialize();
- registerDummyUserDefinedFunction();
+ registerDummyStarlarkFunction();
scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')");
evalAndExport(
"r1 = rule(impl, ",
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
index 9ead6c1..a017ac0 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
@@ -34,7 +34,7 @@
eval("def func(a,b,c):",
" a = 1",
" b = a\n");
- UserDefinedFunction stmt = (UserDefinedFunction) lookup("func");
+ StarlarkFunction stmt = (StarlarkFunction) lookup("func");
assertThat(stmt).isNotNull();
assertThat(stmt.getName()).isEqualTo("func");
assertThat(stmt.getSignature().getSignature().getShape().getMandatoryPositionals())
diff --git a/src/test/java/com/google/devtools/build/skydoc/MarkdownRendererTest.java b/src/test/java/com/google/devtools/build/skydoc/MarkdownRendererTest.java
index aafdc89..4596291 100644
--- a/src/test/java/com/google/devtools/build/skydoc/MarkdownRendererTest.java
+++ b/src/test/java/com/google/devtools/build/skydoc/MarkdownRendererTest.java
@@ -25,7 +25,7 @@
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.ProviderFieldInfo;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.ProviderInfo;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.RuleInfo;
-import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.UserDefinedFunctionInfo;
+import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.StarlarkFunctionInfo;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -131,8 +131,8 @@
.setDocString("the first parameter")
.setDefaultValue("32")
.build();
- UserDefinedFunctionInfo funcInfo =
- UserDefinedFunctionInfo.newBuilder()
+ StarlarkFunctionInfo funcInfo =
+ StarlarkFunctionInfo.newBuilder()
.setFunctionName("my_function")
.setDocString("This function does something.")
.addParameter(paramInfo)
diff --git a/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java b/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java
index 1f04f8b..fba1bdc 100644
--- a/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java
+++ b/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java
@@ -23,8 +23,8 @@
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.skylark.util.SkylarkTestCase;
import com.google.devtools.build.lib.syntax.ParserInputSource;
+import com.google.devtools.build.lib.syntax.StarlarkFunction;
import com.google.devtools.build.lib.syntax.StarlarkSemantics;
-import com.google.devtools.build.lib.syntax.UserDefinedFunction;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.skydoc.SkydocMain.StarlarkEvaluationException;
@@ -36,7 +36,7 @@
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.ModuleInfo;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.ProviderInfo;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.RuleInfo;
-import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.UserDefinedFunctionInfo;
+import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.StarlarkFunctionInfo;
import java.io.IOException;
import java.util.Map;
import java.util.stream.Collectors;
@@ -395,7 +395,7 @@
" \"\"\"",
" pass");
- ImmutableMap.Builder<String, UserDefinedFunction> functionInfoBuilder = ImmutableMap.builder();
+ ImmutableMap.Builder<String, StarlarkFunction> functionInfoBuilder = ImmutableMap.builder();
skydocMain.eval(
StarlarkSemantics.DEFAULT_SEMANTICS,
@@ -406,7 +406,7 @@
ImmutableMap.builder(),
ImmutableMap.builder());
- UserDefinedFunction checkSourcesFn = functionInfoBuilder.build().get("check_sources");
+ StarlarkFunction checkSourcesFn = functionInfoBuilder.build().get("check_sources");
DocstringParseException expected =
assertThrows(
DocstringParseException.class,
@@ -439,7 +439,7 @@
"\"\"\"",
"pass");
- ImmutableMap.Builder<String, UserDefinedFunction> funcInfoMap = ImmutableMap.builder();
+ ImmutableMap.Builder<String, StarlarkFunction> funcInfoMap = ImmutableMap.builder();
skydocMain.eval(
StarlarkSemantics.DEFAULT_SEMANTICS,
@@ -450,17 +450,17 @@
ImmutableMap.builder(),
ImmutableMap.builder());
- Map<String, UserDefinedFunction> functions = funcInfoMap.build();
+ Map<String, StarlarkFunction> functions = funcInfoMap.build();
assertThat(functions).hasSize(1);
ModuleInfo moduleInfo =
- new ProtoRenderer().appendUserDefinedFunctionInfos(functions).getModuleInfo().build();
- UserDefinedFunctionInfo funcInfo = moduleInfo.getFuncInfo(0);
+ new ProtoRenderer().appendStarlarkFunctionInfos(functions).getModuleInfo().build();
+ StarlarkFunctionInfo funcInfo = moduleInfo.getFuncInfo(0);
assertThat(funcInfo.getFunctionName()).isEqualTo("check_function");
assertThat(getParamNames(funcInfo)).containsExactly("foo", "bar", "baz").inOrder();
}
- private static Iterable<String> getParamNames(UserDefinedFunctionInfo funcInfo) {
+ private static Iterable<String> getParamNames(StarlarkFunctionInfo funcInfo) {
return funcInfo.getParameterList().stream()
.map(param -> param.getName())
.collect(Collectors.toList());