Invert typechecking boolean logic
diff --git a/compiler/front_end/constraints_test.py b/compiler/front_end/constraints_test.py
index 2f2f626..eac1232 100644
--- a/compiler/front_end/constraints_test.py
+++ b/compiler/front_end/constraints_test.py
@@ -24,7 +24,6 @@
 from compiler.util import test_util
 
 
-
 def _make_ir_from_emb(emb_text, name="m.emb"):
   ir, unused_debug_info, errors = glue.parse_emboss_file(
       name,
diff --git a/compiler/util/ir_data.py b/compiler/util/ir_data.py
index fa284c4..624b09a 100644
--- a/compiler/util/ir_data.py
+++ b/compiler/util/ir_data.py
@@ -65,21 +65,21 @@
     def __setattr__(self, name: str, value) -> None:
       """Debug-only hook that adds basic type checking for ir_data fields."""
       if spec := self.field_specs.all_field_specs.get(name):
-        if (
+        if not (
             # Check if it's the expected type
-            not isinstance(value, spec.data_type) and
+            isinstance(value, spec.data_type) or
             # Oneof fields are a special case
-            not spec.is_oneof and
+            spec.is_oneof or
             # Optional fields can be set to None
-            not (spec.container is ir_data_fields.FieldContainer.OPTIONAL and
-                 value is None) and
+            (spec.container is ir_data_fields.FieldContainer.OPTIONAL and
+                 value is None) or
             # Sequences can be a few variants of lists
-            not (spec.is_sequence and
+            (spec.is_sequence and
                  isinstance(value, (
                     list, ir_data_fields.TemporaryCopyValuesList,
-                    ir_data_fields.CopyValuesList))) and
+                    ir_data_fields.CopyValuesList))) or
             # An enum value can be an int
-            not (spec.is_enum and isinstance(value, int))):
+            (spec.is_enum and isinstance(value, int))):
           raise AttributeError(
             f"Cannot set {value} (type {value.__class__}) for type"
              "{spec.data_type}")