Skip to content

Commit

Permalink
Format with Black.
Browse files Browse the repository at this point in the history
  • Loading branch information
reventlov committed Oct 5, 2024
1 parent f90c011 commit 9e671c6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
4 changes: 1 addition & 3 deletions compiler/back_end/cpp/header_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions compiler/front_end/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
5 changes: 1 addition & 4 deletions compiler/front_end/symbol_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion compiler/front_end/type_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 4 additions & 12 deletions compiler/front_end/type_check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit 9e671c6

Please sign in to comment.