diff --git a/compiler/back_end/cpp/header_generator.py b/compiler/back_end/cpp/header_generator.py index 7c6e56d..69a97f6 100644 --- a/compiler/back_end/cpp/header_generator.py +++ b/compiler/back_end/cpp/header_generator.py @@ -842,9 +842,7 @@ def _render_expression(expression, ir, field_reader=None, subexpressions=None): ) else: # There shouldn't be any "opaque" type expressions here. - assert False, "Unhandled expression type {}".format( - expression.type.which_type - ) + assert False, "Unhandled expression type {}".format(expression.type.which_type) result = None # Otherwise, render the operation. diff --git a/compiler/front_end/constraints.py b/compiler/front_end/constraints.py index 3753ffb..44b884d 100644 --- a/compiler/front_end/constraints.py +++ b/compiler/front_end/constraints.py @@ -567,7 +567,9 @@ def _bounds_can_fit_any_64_bit_integer_type(minimum, maximum): def _integer_bounds_errors_for_expression(expression, source_file_name): """Checks that `expression` is in range for int64_t or uint64_t.""" # Only check non-constant subexpressions. - if expression.which_expression == "function" and not ir_util.is_constant_type(expression.type): + if expression.which_expression == "function" and not ir_util.is_constant_type( + expression.type + ): errors = [] for arg in expression.function.args: errors += _integer_bounds_errors_for_expression(arg, source_file_name) @@ -584,7 +586,9 @@ def _integer_bounds_errors_for_expression(expression, source_file_name): ) if errors: return errors - if expression.which_expression == "function" and not ir_util.is_constant_type(expression.type): + if expression.which_expression == "function" and not ir_util.is_constant_type( + expression.type + ): int64_only_clauses = [] uint64_only_clauses = [] for clause in [expression] + list(expression.function.args): diff --git a/compiler/front_end/symbol_resolver.py b/compiler/front_end/symbol_resolver.py index 53f2baa..0590b0d 100644 --- a/compiler/front_end/symbol_resolver.py +++ b/compiler/front_end/symbol_resolver.py @@ -459,10 +459,7 @@ def _resolve_field_reference(field_reference, source_file_name, errors, ir): previous_reference = field_reference.path[0] for ref in field_reference.path[1:]: while ir_util.field_is_virtual(previous_field): - if ( - previous_field.read_transform.which_expression - == "field_reference" - ): + if previous_field.read_transform.which_expression == "field_reference": # Pass a separate error list into the recursive _resolve_field_reference # call so that only one copy of the error for a particular reference # will actually surface: in particular, the one that results from a diff --git a/compiler/front_end/type_check.py b/compiler/front_end/type_check.py index 0bfe916..0fda410 100644 --- a/compiler/front_end/type_check.py +++ b/compiler/front_end/type_check.py @@ -535,7 +535,10 @@ def _type_check_passed_parameters(atomic_type, ir, source_file_name, errors): # definition site; no need for another, probably-confusing error at any # usage sites. continue - if atomic_type.runtime_parameter[i].type.which_type != referenced_type.runtime_parameter[i].type.which_type: + if ( + atomic_type.runtime_parameter[i].type.which_type + != referenced_type.runtime_parameter[i].type.which_type + ): errors.append( [ error.error( diff --git a/compiler/front_end/type_check_test.py b/compiler/front_end/type_check_test.py index fce5a14..766f9e8 100644 --- a/compiler/front_end/type_check_test.py +++ b/compiler/front_end/type_check_test.py @@ -103,12 +103,8 @@ def test_adds_enum_operation_type(self): self.assertEqual([], error.filter_errors(type_check.annotate_types(ir))) expression = ir.module[0].type[0].structure.field[1].location.size self.assertEqual(expression.type.which_type, "boolean") - self.assertEqual( - expression.function.args[0].type.which_type, "enumeration" - ) - self.assertEqual( - expression.function.args[1].type.which_type, "enumeration" - ) + self.assertEqual(expression.function.args[0].type.which_type, "enumeration") + self.assertEqual(expression.function.args[1].type.which_type, "enumeration") def test_adds_enum_comparison_operation_type(self): ir = self._make_ir( @@ -121,12 +117,8 @@ def test_adds_enum_comparison_operation_type(self): self.assertEqual([], error.filter_errors(type_check.annotate_types(ir))) expression = ir.module[0].type[0].structure.field[1].location.size self.assertEqual(expression.type.which_type, "boolean") - self.assertEqual( - expression.function.args[0].type.which_type, "enumeration" - ) - self.assertEqual( - expression.function.args[1].type.which_type, "enumeration" - ) + self.assertEqual(expression.function.args[0].type.which_type, "enumeration") + self.assertEqual(expression.function.args[1].type.which_type, "enumeration") def test_adds_integer_field_type(self): ir = self._make_ir(