Open EricRahm opened 1 month ago
FYI @robrussell
This does point to a larger hole in the unit tests for error messages: they should either check the actual numbers for the source locations (thorough, but slightly brittle) or at least check that the source locations are not defaulted.
due to the nature of auto-adding fields as they're accessed
Just a minor point: (in the current implementation) fields aren't added as they are accessed, but they do have default values if they are read without being accessed. ...element_count.HasField('source_location')
should still return False
here.
Just a minor point: (in the current implementation) fields aren't added as they are accessed, but they do have default values if they are read without being accessed.
...element_count.HasField('source_location')
should still returnFalse
here.
Reworded to "auto-generating"
We currently have a test that checks that "Array dimensions can only be omitted for the outermost dimension",
ConstraintsTest.test_error_on_missing_inner_array_size
:This test passes as an error is generated and a source location is listed.
While working on a refactoring in #149 I noticed that the error itself is missing valid source locations: due to the nature of auto-generating fields as they're accessed
error_array.base_type.array_type.element_count.source_location
ends up yielding a default value which matches the default value generated by the compiler error.We can reproduce this with the following:
Note the error is at
0:0
.