Repository navigation
check: a u64 from a call that took a key does not point at it - #4431
fengqiaoqu wants to merge 2 commits into
Conversation
A call given a reference to a key can return an integer. The escape check used to keep the provenance of that key on the result. A later integer cast, whose type the probe also missed, was then refused as if it could be stored through self (E4005, vx-lang#4428). A value whose type cannot hold a reference does not point at anything. The type probe now sees the type a cast names.
|
Review of this PR. Finding 1 comes from reading the code. Didn't built the PR or ran the example. Correctness
Cost
Tests
Process
|
The release test job failed on this file: vx-format rewrote the one-line if and the two Piece literals. Debug tests do not run that check.
Fixes #4428.
map_hash(&key)returns au64. The escape check treated that result as if it pointed atkey, and then refusedself.set_ctrl_byte(i, map_tag(h) as u8)with E4005 when the key type itself holds a reference. Au64cannot hold a reference, so it does not point at anything.Two changes:
ref_provenance_ofreturns nothing when the expression's type is known and cannot hold a reference.h as u8is au8, not unknown (unknown was treated as "could hold a reference").I reproduced the error on the
put_newsketch in the issue (E4005 athash_map.vx:339:10) and on the reduced test in this PR. After the fix, both compile. Existing E4005 fail tests I ran still report the error.