Skip to content

Commit

Permalink
Update test_error_on_missing_inner_array_size
Browse files Browse the repository at this point in the history
This adds a note on an existing latent issue in the source location
provided in errors related to missing inner array sizes. Issue google#153 has
been filed to track the bug.
  • Loading branch information
EricRahm committed Jul 8, 2024
1 parent c4d0956 commit 9b98d3f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compiler/front_end/constraints_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
from compiler.front_end import constraints
from compiler.front_end import glue
from compiler.util import error
from compiler.util import ir_data_utils
from compiler.util import ir_util
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,
Expand All @@ -38,10 +40,17 @@ class ConstraintsTest(unittest.TestCase):
def test_error_on_missing_inner_array_size(self):
ir = _make_ir_from_emb("struct Foo:\n"
" 0 [+1] UInt:8[][1] one_byte\n")
# There is a latent issue here where the source location reported in this
# error is using a default value of 0:0. An issue is filed at
# https://github.com/google/emboss/issues/153 for further investigation.
# In the meantime we use `ir_data_utils.reader` to mimic this legacy
# behavior.
error_array = ir_data_utils.reader(
ir.module[0].type[0].structure.field[0].type.array_type)
self.assertEqual([[
error.error(
"m.emb",
None, # This is probably a latent bug
error_array.base_type.array_type.element_count.source_location,
"Array dimensions can only be omitted for the outermost dimension.")
]], error.filter_errors(constraints.check_constraints(ir)))

Expand Down

0 comments on commit 9b98d3f

Please sign in to comment.