Repository navigation
audit:storage checks the type table (#692) - #3390
Merged
Merged
Conversation
…ctor lies in the table and names types, and every typed expression names a type (#692)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #692 (the range checks; the context rule for sub-byte integer types is left, see below).
get_generic_inst_argonce read the argument vector of a type that is not a generic instance. What it returned depended on the type table's layout; under one layout it was a sub-byte integer, a literal was typed with it, andaudit:allreported no violation. The accessors are kind-guarded since; this is the instrument for the class.audit:storage(and soaudit:all) now also checks:type_extraand each argument is a type id (Analysis.analysis_generic_instance_violations, a function of the table's columns);typed_expr_typesis a type id.Clean on the compiler's own source:
with analyze src/main.w audit:storage→facts=1560278 violations=0 ok.Test:
test/internals/analysis_type_table_test.whands the check tables with a stray argument, a vector that leaves the table and a negative start, and a clean one.Not done, and why: "a sub-byte integer type only inside a bit-packed layout". A bitfield setter takes its field's type (D147), so a literal typed
u3is legitimate there; the rule needs the expression's context, not a range check.Battery GREEN (6f4b99c).