Make SkylarkClassObject "Bazel-specific".

This in preparation to DeclaredProviders implementation.

--
MOS_MIGRATED_REVID=129420617
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 65d0c48ab..07a8c6b 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
@@ -22,6 +22,7 @@
 
 import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.devtools.build.lib.cmdline.Label;
@@ -33,15 +34,23 @@
 import com.google.devtools.build.lib.packages.RuleClass;
 import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
 import com.google.devtools.build.lib.packages.SkylarkAspect;
+import com.google.devtools.build.lib.packages.SkylarkClassObject;
 import com.google.devtools.build.lib.rules.SkylarkAttr;
 import com.google.devtools.build.lib.rules.SkylarkFileType;
 import com.google.devtools.build.lib.rules.SkylarkRuleClassFunctions;
 import com.google.devtools.build.lib.rules.SkylarkRuleClassFunctions.RuleFunction;
 import com.google.devtools.build.lib.skylark.util.SkylarkTestCase;
+import com.google.devtools.build.lib.syntax.ClassObject;
+import com.google.devtools.build.lib.syntax.Environment;
 import com.google.devtools.build.lib.syntax.EvalException;
+import com.google.devtools.build.lib.syntax.EvalUtils;
+import com.google.devtools.build.lib.syntax.SkylarkDict;
+import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
+import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
+import com.google.devtools.build.lib.syntax.SkylarkNestedSet;
 import com.google.devtools.build.lib.syntax.Type;
 import com.google.devtools.build.lib.util.FileTypeSet;
-
+import java.util.Collection;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -748,4 +757,213 @@
     // Should succeed without a "licenses attribute is potentially configurable" loading error:
     createRuleContext("//third_party/foo:r");
   }
+
+  @Test
+  public void testStructCreation() throws Exception {
+    // TODO(fwe): cannot be handled by current testing suite
+    eval("x = struct(a = 1, b = 2)");
+    assertThat(lookup("x")).isInstanceOf(ClassObject.class);
+  }
+
+  @Test
+  public void testStructFields() throws Exception {
+    // TODO(fwe): cannot be handled by current testing suite
+    eval("x = struct(a = 1, b = 2)");
+    ClassObject x = (ClassObject) lookup("x");
+    assertEquals(1, x.getValue("a"));
+    assertEquals(2, x.getValue("b"));
+  }
+
+  @Test
+  public void testStructAccessingFieldsFromSkylark() throws Exception {
+    eval("x = struct(a = 1, b = 2)", "x1 = x.a", "x2 = x.b");
+    assertThat(lookup("x1")).isEqualTo(1);
+    assertThat(lookup("x2")).isEqualTo(2);
+  }
+
+  @Test
+  public void testStructAccessingUnknownField() throws Exception {
+    checkErrorContains(
+            "'struct' object has no attribute 'c'\n" + "Available attributes: a, b",
+            "x = struct(a = 1, b = 2)",
+            "y = x.c");
+  }
+
+  @Test
+  public void testStructAccessingUnknownFieldWithArgs() throws Exception {
+    checkErrorContains(
+        "struct has no method 'c'", "x = struct(a = 1, b = 2)", "y = x.c()");
+  }
+
+  @Test
+  public void testStructAccessingNonFunctionFieldWithArgs() throws Exception {
+    checkErrorContains(
+        "struct field 'a' is not a function", "x = struct(a = 1, b = 2)", "x1 = x.a(1)");
+  }
+
+  @Test
+  public void testStructAccessingFunctionFieldWithArgs() throws Exception {
+    eval("def f(x): return x+5", "x = struct(a = f, b = 2)", "x1 = x.a(1)");
+    assertThat(lookup("x1")).isEqualTo(6);
+  }
+
+  @Test
+  public void testStructPosArgs() throws Exception {
+    checkErrorContains(
+        "struct(**kwargs) does not accept positional arguments, but got 1", "x = struct(1, b = 2)");
+  }
+
+  @Test
+  public void testStructConcatenationFieldNames() throws Exception {
+    // TODO(fwe): cannot be handled by current testing suite
+    eval("x = struct(a = 1, b = 2)",
+        "y = struct(c = 1, d = 2)",
+        "z = x + y\n");
+    SkylarkClassObject z = (SkylarkClassObject) lookup("z");
+    assertEquals(ImmutableSet.of("a", "b", "c", "d"), z.getKeys());
+  }
+
+  @Test
+  public void testStructConcatenationFieldValues() throws Exception {
+    // TODO(fwe): cannot be handled by current testing suite
+    eval("x = struct(a = 1, b = 2)",
+        "y = struct(c = 1, d = 2)",
+        "z = x + y\n");
+    SkylarkClassObject z = (SkylarkClassObject) lookup("z");
+    assertEquals(1, z.getValue("a"));
+    assertEquals(2, z.getValue("b"));
+    assertEquals(1, z.getValue("c"));
+    assertEquals(2, z.getValue("d"));
+  }
+
+  @Test
+  public void testStructConcatenationCommonFields() throws Exception {
+    checkErrorContains("Cannot concat structs with common field(s): a",
+        "x = struct(a = 1, b = 2)", "y = struct(c = 1, a = 2)", "z = x + y\n");
+  }
+
+  @Test
+  public void testConditionalStructConcatenation() throws Exception {
+    // TODO(fwe): cannot be handled by current testing suite
+    eval("def func():",
+        "  x = struct(a = 1, b = 2)",
+        "  if True:",
+        "    x += struct(c = 1, d = 2)",
+        "  return x",
+        "x = func()");
+    SkylarkClassObject x = (SkylarkClassObject) lookup("x");
+    assertEquals(1, x.getValue("a"));
+    assertEquals(2, x.getValue("b"));
+    assertEquals(1, x.getValue("c"));
+    assertEquals(2, x.getValue("d"));
+  }
+
+  @Test
+  public void testGetattrNoAttr() throws Exception {
+    checkErrorContains("Object of type 'struct' has no attribute \"b\"",
+        "s = struct(a='val')", "getattr(s, 'b')");
+  }
+
+  @Test
+  public void testGetattr() throws Exception {
+    eval(
+        "s = struct(a='val')",
+        "x = getattr(s, 'a')",
+        "y = getattr(s, 'b', 'def')",
+        "z = getattr(s, 'b', default = 'def')",
+        "w = getattr(s, 'a', default='ignored')");
+    assertThat(lookup("x")).isEqualTo("val");
+    assertThat(lookup("y")).isEqualTo("def");
+    assertThat(lookup("z")).isEqualTo("def");
+    assertThat(lookup("w")).isEqualTo("val");
+  }
+
+  @Test
+  public void testHasattr() throws Exception {
+    eval("s = struct(a=1)",
+        "x = hasattr(s, 'a')",
+        "y = hasattr(s, 'b')\n");
+    assertThat(lookup("x")).isEqualTo(true);
+    assertThat(lookup("y")).isEqualTo(false);
+  }
+
+  @Test
+  public void testStructStr() throws Exception {
+    assertThat(eval("str(struct(x = 2, y = 3, z = 4))"))
+        .isEqualTo("struct(x = 2, y = 3, z = 4)");
+  }
+
+  @Test
+  public void testStructsInSets() throws Exception {
+    eval("set([struct(a='a')])");
+  }
+
+  @Test
+  public void testStructMembersAreImmutable() throws Exception {
+    checkErrorContains(
+        "can only assign to variables and tuples, not to 's.x'",
+        "s = struct(x = 'a')",
+        "s.x = 'b'\n");
+  }
+
+  @Test
+  public void testStructDictMembersAreImmutable() throws Exception {
+    checkErrorContains(
+        "can only assign to variables and tuples, not to 's.x['b']'",
+        "s = struct(x = {'a' : 1})",
+        "s.x['b'] = 2\n");
+  }
+
+  @Test
+  public void testNsetGoodCompositeItem() throws Exception {
+    eval("def func():",
+        "  return set([struct(a='a')])",
+        "s = func()");
+    Collection<Object> result = ((SkylarkNestedSet) lookup("s")).toCollection();
+    assertThat(result).hasSize(1);
+    assertThat(result.iterator().next()).isInstanceOf(SkylarkClassObject.class);
+  }
+
+  @Test
+  public void testNsetBadMutableItem() throws Exception {
+    checkEvalError("sets cannot contain mutable items", "set([([],)])");
+    checkEvalError("sets cannot contain mutable items", "set([struct(a=[])])");
+  }
+
+  private static SkylarkClassObject makeStruct(String field, Object value) {
+    return new SkylarkClassObject(ImmutableMap.of(field, value));
+  }
+
+  private static SkylarkClassObject makeBigStruct(Environment env) {
+    // struct(a=[struct(x={1:1}), ()], b=(), c={2:2})
+    return new SkylarkClassObject(ImmutableMap.<String, Object>of(
+        "a", MutableList.<Object>of(env,
+            new SkylarkClassObject(ImmutableMap.<String, Object>of(
+                "x", SkylarkDict.<Object, Object>of(env, 1, 1))),
+            Tuple.of()),
+        "b", Tuple.of(),
+        "c", SkylarkDict.<Object, Object>of(env, 2, 2)));
+  }
+
+  @Test
+  public void testStructMutabilityShallow() throws Exception {
+    assertTrue(EvalUtils.isImmutable(makeStruct("a", 1)));
+  }
+
+  private static MutableList<Object> makeList(Environment env) {
+    return MutableList.<Object>of(env, 1, 2, 3);
+  }
+
+
+  @Test
+  public void testStructMutabilityDeep() throws Exception {
+    assertTrue(EvalUtils.isImmutable(Tuple.<Object>of(makeList(null))));
+    assertTrue(EvalUtils.isImmutable(makeStruct("a", makeList(null))));
+    assertTrue(EvalUtils.isImmutable(makeBigStruct(null)));
+
+    assertFalse(EvalUtils.isImmutable(Tuple.<Object>of(makeList(ev.getEnvironment()))));
+    assertFalse(EvalUtils.isImmutable(makeStruct("a", makeList(ev.getEnvironment()))));
+    assertFalse(EvalUtils.isImmutable(makeBigStruct(ev.getEnvironment())));
+  }
+
 }
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
index cf17c9d..5efd8a8 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
@@ -149,6 +149,7 @@
   }
 
   protected void checkErrorContains(String errorMsg, String... lines) throws Exception {
+    ev.setFailFast(false);
     try {
       eval(lines);
       fail("checkErrorContains(String, String...): There was no error");
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
index 26763ea..7ce40aa 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
@@ -19,8 +19,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.devtools.build.lib.syntax.ClassObject.SkylarkClassObject;
 import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
 import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
 import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
@@ -44,21 +42,6 @@
     return SkylarkDict.<Object, Object>of(env, 1, 1, 2, 2);
   }
 
-  private static SkylarkClassObject makeStruct(String field, Object value) {
-    return new SkylarkClassObject(ImmutableMap.of(field, value));
-  }
-
-  private static SkylarkClassObject makeBigStruct(Environment env) {
-    // struct(a=[struct(x={1:1}), ()], b=(), c={2:2})
-    return new SkylarkClassObject(ImmutableMap.<String, Object>of(
-        "a", MutableList.<Object>of(env,
-            new SkylarkClassObject(ImmutableMap.<String, Object>of(
-                "x", SkylarkDict.<Object, Object>of(env, 1, 1))),
-            Tuple.of()),
-        "b", Tuple.of(),
-        "c", SkylarkDict.<Object, Object>of(env, 2, 2)));
-  }
-
   @Test
   public void testEmptyStringToIterable() throws Exception {
     assertThat(EvalUtils.toIterable("", null)).isEmpty();
@@ -88,7 +71,6 @@
   @Test
   public void testDatatypeMutabilityShallow() throws Exception {
     assertTrue(EvalUtils.isImmutable(Tuple.of(1, 2, 3)));
-    assertTrue(EvalUtils.isImmutable(makeStruct("a", 1)));
 
     // Mutability depends on the environment.
     assertTrue(EvalUtils.isImmutable(makeList(null)));
@@ -100,12 +82,8 @@
   @Test
   public void testDatatypeMutabilityDeep() throws Exception {
     assertTrue(EvalUtils.isImmutable(Tuple.<Object>of(makeList(null))));
-    assertTrue(EvalUtils.isImmutable(makeStruct("a", makeList(null))));
-    assertTrue(EvalUtils.isImmutable(makeBigStruct(null)));
 
     assertFalse(EvalUtils.isImmutable(Tuple.<Object>of(makeList(env))));
-    assertFalse(EvalUtils.isImmutable(makeStruct("a", makeList(env))));
-    assertFalse(EvalUtils.isImmutable(makeBigStruct(env)));
   }
 
   @Test
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 1eaecb7..5f994db 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
@@ -22,7 +22,6 @@
 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;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -1661,9 +1660,6 @@
         .testStatement("str(False)", "False")
         .testStatement("str(None)", "None")
         .testStatement("str(str)", "<function str>");
-
-    new SkylarkTest()
-        .testStatement("str(struct(x = 2, y = 3, z = 4))", "struct(x = 2, y = 3, z = 4)");
   }
 
   @Test
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 2b6ebfc..235968f 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
@@ -20,7 +20,6 @@
 import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
 import com.google.devtools.build.lib.actions.Artifact;
 import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
 import com.google.devtools.build.lib.analysis.FileConfiguredTarget;
@@ -30,7 +29,6 @@
 import com.google.devtools.build.lib.skylarkinterface.Param;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.syntax.ClassObject.SkylarkClassObject;
 import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
 import com.google.devtools.build.lib.testutil.TestMode;
 import org.junit.Before;
@@ -712,22 +710,6 @@
   }
 
   @Test
-  public void testConditionalStructConcatenation() throws Exception {
-    // TODO(fwe): cannot be handled by current testing suite
-    eval("def func():",
-        "  x = struct(a = 1, b = 2)",
-        "  if True:",
-        "    x += struct(c = 1, d = 2)",
-        "  return x",
-        "x = func()");
-    SkylarkClassObject x = (SkylarkClassObject) lookup("x");
-    assertEquals(1, x.getValue("a"));
-    assertEquals(2, x.getValue("b"));
-    assertEquals(1, x.getValue("c"));
-    assertEquals(2, x.getValue("d"));
-  }
-
-  @Test
   public void testJavaFunctionReturnsMutableObject() throws Exception {
     new SkylarkTest()
         .update("mock", new Mock())
@@ -825,93 +807,6 @@
   }
 
   @Test
-  public void testStructCreation() throws Exception {
-    // TODO(fwe): cannot be handled by current testing suite
-    eval("x = struct(a = 1, b = 2)");
-    assertThat(lookup("x")).isInstanceOf(ClassObject.class);
-  }
-
-  @Test
-  public void testStructFields() throws Exception {
-    // TODO(fwe): cannot be handled by current testing suite
-    eval("x = struct(a = 1, b = 2)");
-    ClassObject x = (ClassObject) lookup("x");
-    assertEquals(1, x.getValue("a"));
-    assertEquals(2, x.getValue("b"));
-  }
-
-  @Test
-  public void testStructAccessingFieldsFromSkylark() throws Exception {
-    new SkylarkTest()
-        .setUp("x = struct(a = 1, b = 2)", "x1 = x.a", "x2 = x.b")
-        .testLookup("x1", 1)
-        .testLookup("x2", 2);
-  }
-
-  @Test
-  public void testStructAccessingUnknownField() throws Exception {
-    new SkylarkTest()
-        .testIfErrorContains(
-            "'struct' object has no attribute 'c'\n" + "Available attributes: a, b",
-            "x = struct(a = 1, b = 2)",
-            "y = x.c");
-  }
-
-  @Test
-  public void testStructAccessingUnknownFieldWithArgs() throws Exception {
-    new SkylarkTest().testIfExactError(
-        "struct has no method 'c'", "x = struct(a = 1, b = 2)", "y = x.c()");
-  }
-
-  @Test
-  public void testStructAccessingNonFunctionFieldWithArgs() throws Exception {
-    new SkylarkTest().testIfExactError(
-        "struct field 'a' is not a function", "x = struct(a = 1, b = 2)", "x1 = x.a(1)");
-  }
-
-  @Test
-  public void testStructAccessingFunctionFieldWithArgs() throws Exception {
-    new SkylarkTest()
-        .setUp("def f(x): return x+5", "x = struct(a = f, b = 2)", "x1 = x.a(1)")
-        .testLookup("x1", 6);
-  }
-
-  @Test
-  public void testStructPosArgs() throws Exception {
-    new SkylarkTest().testIfExactError(
-        "struct(**kwargs) does not accept positional arguments, but got 1", "x = struct(1, b = 2)");
-  }
-
-  @Test
-  public void testStructConcatenationFieldNames() throws Exception {
-    // TODO(fwe): cannot be handled by current testing suite
-    eval("x = struct(a = 1, b = 2)",
-        "y = struct(c = 1, d = 2)",
-        "z = x + y\n");
-    SkylarkClassObject z = (SkylarkClassObject) lookup("z");
-    assertEquals(ImmutableSet.of("a", "b", "c", "d"), z.getKeys());
-  }
-
-  @Test
-  public void testStructConcatenationFieldValues() throws Exception {
-    // TODO(fwe): cannot be handled by current testing suite
-    eval("x = struct(a = 1, b = 2)",
-        "y = struct(c = 1, d = 2)",
-        "z = x + y\n");
-    SkylarkClassObject z = (SkylarkClassObject) lookup("z");
-    assertEquals(1, z.getValue("a"));
-    assertEquals(2, z.getValue("b"));
-    assertEquals(1, z.getValue("c"));
-    assertEquals(2, z.getValue("d"));
-  }
-
-  @Test
-  public void testStructConcatenationCommonFields() throws Exception {
-    new SkylarkTest().testIfExactError("Cannot concat structs with common field(s): a",
-        "x = struct(a = 1, b = 2)", "y = struct(c = 1, a = 2)", "z = x + y\n");
-  }
-
-  @Test
   public void testDotExpressionOnNonStructObject() throws Exception {
     new SkylarkTest().testIfExactError("Object of type 'string' has no field \"field\"",
         "x = 'a'.field");
@@ -1026,15 +921,6 @@
   }
 
   @Test
-  public void testHasattr() throws Exception {
-    new SkylarkTest().setUp("s = struct(a=1)",
-      "x = hasattr(s, 'a')",
-      "y = hasattr(s, 'b')\n")
-      .testLookup("x", Boolean.TRUE)
-      .testLookup("y", Boolean.FALSE);
-  }
-
-  @Test
   public void testHasattrMethods() throws Exception {
     new SkylarkTest()
         .update("mock", new Mock())
@@ -1049,23 +935,6 @@
   }
 
   @Test
-  public void testGetattr() throws Exception {
-    new SkylarkTest()
-        .setUp("s = struct(a='val')", "x = getattr(s, 'a')", "y = getattr(s, 'b', 'def')",
-            "z = getattr(s, 'b', default = 'def')", "w = getattr(s, 'a', default='ignored')")
-        .testLookup("x", "val")
-        .testLookup("y", "def")
-        .testLookup("z", "def")
-        .testLookup("w", "val");
-  }
-
-  @Test
-  public void testGetattrNoAttr() throws Exception {
-    new SkylarkTest().testIfExactError("Object of type 'struct' has no attribute \"b\"",
-        "s = struct(a='val')", "getattr(s, 'b')");
-  }
-
-  @Test
   public void testListAnTupleConcatenationDoesNotWorkInSkylark() throws Exception {
     new SkylarkTest().testIfExactError("unsupported operand type(s) for +: 'list' and 'tuple'",
         "[1, 2] + (3, 4)");
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
index 5c6535e..a0d8420 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
@@ -18,19 +18,15 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.devtools.build.lib.collect.nestedset.Order;
-import com.google.devtools.build.lib.syntax.ClassObject.SkylarkClassObject;
 import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
 import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
 
 /**
  * Tests for SkylarkNestedSet.
@@ -156,22 +152,6 @@
   }
 
   @Test
-  public void testNsetGoodCompositeItem() throws Exception {
-    eval("def func():",
-         "  return set([struct(a='a')])",
-         "s = func()");
-    Collection<Object> result = get("s").toCollection();
-    assertThat(result).hasSize(1);
-    assertThat(result.iterator().next()).isInstanceOf(SkylarkClassObject.class);
-  }
-
-  @Test
-  public void testNsetBadMutableItem() throws Exception {
-    checkEvalError("sets cannot contain mutable items", "set([([],)])");
-    checkEvalError("sets cannot contain mutable items", "set([struct(a=[])])");
-  }
-
-  @Test
   public void testNsetToString() throws Exception {
     eval("s = set() + [2, 4, 6] + [3, 4, 5]",
         "x = str(s)");
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
index c44e5c9..b7bd6f6 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
@@ -18,11 +18,11 @@
 import com.google.devtools.build.lib.actions.Artifact;
 import com.google.devtools.build.lib.analysis.RuleConfiguredTarget;
 import com.google.devtools.build.lib.events.Event;
+import com.google.devtools.build.lib.packages.SkylarkClassObject;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
 import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
 import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
-
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -112,22 +112,6 @@
   }
 
   @Test
-  public void testStructMembersAreImmutable() {
-    checkError(
-        "can only assign to variables and tuples, not to 's.x'",
-        "s = struct(x = 'a')",
-        "s.x = 'b'\n");
-  }
-
-  @Test
-  public void testStructDictMembersAreImmutable() {
-    checkError(
-        "can only assign to variables and tuples, not to 's.x['b']'",
-        "s = struct(x = {'a' : 1})",
-        "s.x['b'] = 2\n");
-  }
-
-  @Test
   public void testTupleLiteralWorksForDifferentTypes() throws Exception {
     parse("('a', 1)");
   }
@@ -299,11 +283,11 @@
 
     // TODO(bazel-team): fix that?
     assertThat(ClassObject.class.isAnnotationPresent(SkylarkModule.class)).isFalse();
-    assertThat(ClassObject.SkylarkClassObject.class.isAnnotationPresent(SkylarkModule.class))
+    assertThat(SkylarkClassObject.class.isAnnotationPresent(SkylarkModule.class))
         .isTrue();
     assertThat(
-            EvalUtils.getParentWithSkylarkModule(ClassObject.SkylarkClassObject.class)
-                == ClassObject.SkylarkClassObject.class)
+            EvalUtils.getParentWithSkylarkModule(SkylarkClassObject.class)
+                == SkylarkClassObject.class)
         .isTrue();
     assertThat(EvalUtils.getParentWithSkylarkModule(ClassObject.class)).isNull();
   }
@@ -320,8 +304,6 @@
     assertThat(SkylarkType.of(tupleClass)).isEqualTo(SkylarkType.TUPLE);
     assertThat(SkylarkType.TUPLE).isNotEqualTo(SkylarkType.LIST);
 
-    // Also for ClassObject
-    assertThat(SkylarkType.of(ClassObject.SkylarkClassObject.class)).isEqualTo(SkylarkType.STRUCT);
     try {
       SkylarkType.of(ClassObject.class);
       throw new Exception("foo");
@@ -335,7 +317,7 @@
     // TODO(bazel-team): move to some other place to remove dependency of syntax tests on Artifact?
     assertThat(SkylarkType.of(Artifact.SpecialArtifact.class))
         .isEqualTo(SkylarkType.of(Artifact.class));
-    assertThat(SkylarkType.of(RuleConfiguredTarget.class)).isNotEqualTo(SkylarkType.STRUCT);
+    assertThat(SkylarkType.of(RuleConfiguredTarget.class)).isNotEqualTo(SkylarkType.of(SkylarkClassObject.class));
   }
 
   @Test
@@ -348,9 +330,8 @@
     assertThat(SkylarkType.LIST.includes(combo1)).isTrue();
 
     SkylarkType union1 =
-        SkylarkType.Union.of(SkylarkType.DICT, SkylarkType.LIST, SkylarkType.STRUCT);
+        SkylarkType.Union.of(SkylarkType.DICT, SkylarkType.LIST);
     assertThat(union1.includes(SkylarkType.DICT)).isTrue();
-    assertThat(union1.includes(SkylarkType.STRUCT)).isTrue();
     assertThat(union1.includes(combo1)).isTrue();
     assertThat(union1.includes(SkylarkType.STRING)).isFalse();