diff options
author | 2018-04-17 21:30:33 -0700 | |
---|---|---|
committer | 2018-04-17 21:31:38 -0700 | |
commit | 32d34e906b0c5e9b80a97683dc4795d869561ab4 (patch) | |
tree | 7823d2ab8e8da828e4d465be71c353a4e0f725d8 /src/main/java/com/google/devtools/build | |
parent | 827007729889126cd7e07a08116f9bcb82f819a9 (diff) |
Refactor SyntaxTests to not rely on actions/analysis packages arbitrarily
In the process, clean up SkylarkType-related tests.
- Factor test of EvalUtils.getSkylarkType logic from SkylarkEvaluationTest and ValidationTest to EvalUtilsTest.
- Move test of EvalUtils.getSkylarkType's behavior on lists to SkylarkListTest.
- Move other SkylarkType tests from ValidationTest to new SkylarkTypeTest and split them up a little.
- Throughout, don't use Bazel types like Artifact as test subjects.
RELNOTES: None
PiperOrigin-RevId: 193303463
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java index 6fee875c33..15fb66abd4 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java @@ -173,7 +173,7 @@ public final class EvalUtils { * @return a super-class of c to be used in validation-time type inference. */ public static Class<?> getSkylarkType(Class<?> c) { - // TODO(bazel-team): replace these with SkylarkValue-s + // TODO(bazel-team): Iterable and Class likely do not belong here. if (String.class.equals(c) || Boolean.class.equals(c) || Integer.class.equals(c) @@ -181,8 +181,9 @@ public final class EvalUtils { || Class.class.equals(c)) { return c; } - // TODO(bazel-team): also unify all implementations of ClassObject, - // that we used to all print the same as "struct"? + // TODO(bazel-team): We should require all Skylark-addressable values that aren't builtin types + // (String/Boolean/Integer) to implement SkylarkValue. We should also require them to have a + // (possibly inherited) @SkylarkModule annotation. Class<?> parent = SkylarkInterfaceUtils.getParentWithSkylarkModule(c); if (parent != null) { return parent; |