From 88552992017e7ff9bb2dcd796e96a800e637cec7 Mon Sep 17 00:00:00 2001 From: gavinleroy Date: Fri, 27 Dec 2024 20:58:11 -0500 Subject: [PATCH] Ignore path liveness when collecting actual/expected permissions in boundary analysis. --- .../aquascope/src/analysis/boundaries/mod.rs | 13 +++-- .../src/analysis/permissions/context.rs | 39 +------------- .../aquascope/src/analysis/permissions/mod.rs | 37 +++++++++++++- .../src/analysis/permissions/utils.rs | 17 +++---- crates/aquascope/src/analysis/stepper/mod.rs | 2 +- crates/aquascope/src/test_utils.rs | 5 +- .../boundaries__bar@coerced_0.test.snap | 33 ++++++------ .../boundaries__foo@mut_assign.test.snap | 9 ++-- ...ies__get_first@type-driven-flows.test.snap | 21 ++++---- ...st_constrained@type-driven-flows.test.snap | 19 ++++--- ...irst_specified@type-driven-flows.test.snap | 21 ++++---- ...s__main@assignop_path_resolution.test.snap | 51 +++++++++---------- .../boundaries__main@closure_0.test.snap | 41 ++++++++------- .../snapshots/boundaries__main@if_0.test.snap | 41 ++++++++------- .../snapshots/boundaries__main@if_1.test.snap | 41 ++++++++------- .../boundaries__main@match_0.test.snap | 17 +++---- .../boundaries__main@read_on_copy_0.test.snap | 33 ++++++------ ...s__print_first@type-driven-flows.test.snap | 17 +++---- .../snapshots/interpreter__basic.test.snap | 21 ++++---- .../snapshots/interpreter__box.test.snap | 21 ++++---- .../snapshots/interpreter__closure.test.snap | 41 ++++++++------- .../interpreter__nested-ref.test.snap | 17 +++---- .../snapshots/interpreter__stackref.test.snap | 21 ++++---- .../src/editor-utils/boundaries.tsx | 10 ++-- 24 files changed, 286 insertions(+), 302 deletions(-) diff --git a/crates/aquascope/src/analysis/boundaries/mod.rs b/crates/aquascope/src/analysis/boundaries/mod.rs index a902f5182..c0e30719f 100644 --- a/crates/aquascope/src/analysis/boundaries/mod.rs +++ b/crates/aquascope/src/analysis/boundaries/mod.rs @@ -223,7 +223,8 @@ pub struct PermissionsBoundary { #[serde(skip)] byte_location: BytePos, pub expected: Permissions, - pub actual: PermissionsData, + pub actual: Permissions, + pub data: PermissionsData, #[serde(skip_serializing_if = "Option::is_none")] pub expecting_flow: Option, } @@ -232,7 +233,7 @@ impl PermissionsBoundary { pub fn is_violation(&self) -> bool { macro_rules! is_missing { ($this:ident, $perm:ident) => { - ($this.expected.$perm && !$this.actual.permissions.$perm) + ($this.expected.$perm && !$this.actual.$perm) }; } @@ -735,11 +736,11 @@ fn path_to_perm_boundary<'tcx>( &path_locations, )?; - log::debug!("Chosen place at location {place:#?} {loc:#?} other options: {path_locations:#?}"); - let point = ctxt.location_to_point(loc); let path = ctxt.place_to_path(&place); + log::debug!("Chosen place at location {place:#?} {loc:#?} ({point:?},{path:?})\nOther options: {path_locations:#?}"); + Some((point, path)) }; @@ -755,8 +756,9 @@ fn path_to_perm_boundary<'tcx>( }) }) .map(|(point, path)| { - let actual = ctxt.permissions_data_at_point(path, point); + let data = ctxt.permissions_data_at_point(path, point); let expected = path_boundary.expected; + let actual = data.permissions_ignore_liveness(); let expecting_flow = get_flow_permission(analysis, path_boundary.flow_context, hir_id); @@ -781,6 +783,7 @@ fn path_to_perm_boundary<'tcx>( byte_location, expected: expected.into(), actual, + data, expecting_flow, } }); diff --git a/crates/aquascope/src/analysis/permissions/context.rs b/crates/aquascope/src/analysis/permissions/context.rs index eedf01189..825c84b30 100644 --- a/crates/aquascope/src/analysis/permissions/context.rs +++ b/crates/aquascope/src/analysis/permissions/context.rs @@ -300,11 +300,6 @@ impl<'tcx> PermissionsCtxt<'tcx> { loan_read_refined: None, loan_write_refined: None, loan_drop_refined: None, - permissions: Permissions { - read: true, - write: true, - drop: true, - }, } } @@ -349,6 +344,8 @@ impl<'tcx> PermissionsCtxt<'tcx> { path: Path, point: Point, ) -> PermissionsData { + log::trace!("permissions_data_at_point: {:?} at {:?}", path, point); + let empty_hash_move = &HashMap::default(); let empty_hash_loan = &HashMap::default(); let empty_set = &HashSet::default(); @@ -384,36 +381,6 @@ impl<'tcx> PermissionsCtxt<'tcx> { let loan_drop_refined: Option = loan_drop_refined.get(path).map(Into::::into); - let mem_uninit = path_moved.is_some() || path_uninitialized; - - // An English description of the previous Datalog rules: - // - // A path is readable IFF: - // - it is not moved. - // - there doesn't exist a read-refining loan at this point. - // - // A path is writeable IFF: - // - the path's declared type allows for mutability. - // - the path is readable (you can't write if you can't read) - // this implies that the path isn't moved. - // - there doesn't exist a write-refining loan at this point. - // - // A path is droppable(without copy) IFF: - // - the path's declared type is droppable. - // - it isn't moved. - // - no drop-refining loan exists at this point. - let permissions = if !is_live { - Permissions::bottom() - } else { - let read = !mem_uninit && loan_read_refined.is_none(); - - let write = type_writeable && read && loan_write_refined.is_none(); - - let drop = type_droppable && read && loan_drop_refined.is_none(); - - Permissions { read, write, drop } - }; - PermissionsData { type_droppable, type_writeable, @@ -424,7 +391,6 @@ impl<'tcx> PermissionsCtxt<'tcx> { loan_read_refined, loan_write_refined, loan_drop_refined, - permissions, } } @@ -450,7 +416,6 @@ impl<'tcx> PermissionsCtxt<'tcx> { loan_read_refined: None, loan_write_refined: None, loan_drop_refined: None, - permissions: Permissions::bottom(), }) }) .collect::>() diff --git a/crates/aquascope/src/analysis/permissions/mod.rs b/crates/aquascope/src/analysis/permissions/mod.rs index e9f35d305..ec964f810 100644 --- a/crates/aquascope/src/analysis/permissions/mod.rs +++ b/crates/aquascope/src/analysis/permissions/mod.rs @@ -113,9 +113,42 @@ pub struct PermissionsData { #[serde(skip_serializing_if = "Option::is_none")] /// Is a live loan removing `drop` permissions? pub loan_drop_refined: Option, +} + +impl PermissionsData { + /// If the place is not live, then the permissions are always the bottom type. + /// Otherwise, see `permissions_ignore_liveness`. (You may want to ignore liveness + /// when you know a variable is being used, and should therefore be live.) + pub fn permissions(&self) -> Permissions { + if !self.is_live { + Permissions::bottom() + } else { + self.permissions_ignore_liveness() + } + } - /// Computed permissions given the above information. - pub permissions: Permissions, + /// A path is readable IFF: + /// - it is not moved. + /// - there doesn't exist a read-refining loan at this point. + /// + /// A path is writeable IFF: + /// - the path's declared type allows for mutability. + /// - the path is readable (you can't write if you can't read) + /// this implies that the path isn't moved. + /// - there doesn't exist a write-refining loan at this point. + /// + /// A path is droppable(without copy) IFF: + /// - the path's declared type is droppable. + /// - it isn't moved. + /// - no drop-refining loan exists at this point. + pub fn permissions_ignore_liveness(&self) -> Permissions { + let mem_uninit = self.path_moved.is_some() || self.path_uninitialized; + let read = !mem_uninit && self.loan_read_refined.is_none(); + let write = + self.type_writeable && read && self.loan_write_refined.is_none(); + let drop = self.type_droppable && read && self.loan_drop_refined.is_none(); + Permissions { read, write, drop } + } } /// A permissions refiner. [`Loan`]s and moves can refine permissions. diff --git a/crates/aquascope/src/analysis/permissions/utils.rs b/crates/aquascope/src/analysis/permissions/utils.rs index cf3b55194..32492249a 100644 --- a/crates/aquascope/src/analysis/permissions/utils.rs +++ b/crates/aquascope/src/analysis/permissions/utils.rs @@ -28,6 +28,8 @@ pub(crate) fn dump_mir_debug(ctxt: &PermissionsCtxt) { }, ) .unwrap(); + + log::debug!("{:?}", ctxt.polonius_output); } // -------------------------------------------------- @@ -67,7 +69,7 @@ impl JoinSemiLattice for PermissionsDomain<'_> { for (place, perms) in other.0.iter() { match self.0.entry(*place) { Entry::Occupied(mut entry) => { - changed |= entry.get_mut().permissions.join(&perms.permissions); + changed |= entry.get_mut().permissions().join(&perms.permissions()); } Entry::Vacant(entry) => { entry.insert(*perms); @@ -119,7 +121,7 @@ impl DebugWithContext for PermissionsDomain<'_> { r#""# )?; for (place, perms) in self.iter() { - let perms = perms.permissions; + let perms = perms.permissions(); write!( f, r#""# @@ -137,11 +139,11 @@ impl DebugWithContext for PermissionsDomain<'_> { f: &mut std::fmt::Formatter<'_>, ) -> std::fmt::Result { let no_perm_changes = self.0.iter().all(|(place, permsd)| { - let perms = permsd.permissions; + let perms = permsd.permissions(); old .0 .get(place) - .map_or(true, |permd| permd.permissions == perms) + .map_or(true, |permd| permd.permissions() == perms) }); if old == self || no_perm_changes { @@ -153,10 +155,10 @@ impl DebugWithContext for PermissionsDomain<'_> { r#"
{place:?}{perms:?}
"# )?; for (place, perms) in self.0.iter() { - let perms = perms.permissions; + let perms = perms.permissions(); match old.0.get(place) { Some(old_perms) => { - let old_perms = old_perms.permissions; + let old_perms = old_perms.permissions(); if perms != old_perms { write!( f, @@ -214,8 +216,6 @@ impl<'tcx> Analysis<'tcx> for PAnalysis<'_, 'tcx> { .domain_places() .into_iter() .map(|place| { - let path = self.ctxt.place_to_path(&place); - let mp = self.ctxt.max_permissions(path); // NOTE: I'm currently just ignoring the permissions data // for this utility just so we can see the permissions changes. (place, PermissionsData { @@ -228,7 +228,6 @@ impl<'tcx> Analysis<'tcx> for PAnalysis<'_, 'tcx> { loan_read_refined: None, loan_write_refined: None, loan_drop_refined: None, - permissions: mp, }) }) .collect::>() diff --git a/crates/aquascope/src/analysis/stepper/mod.rs b/crates/aquascope/src/analysis/stepper/mod.rs index 7d30e6a44..ae540db81 100644 --- a/crates/aquascope/src/analysis/stepper/mod.rs +++ b/crates/aquascope/src/analysis/stepper/mod.rs @@ -266,7 +266,7 @@ impl Difference for PermissionsData { loan_drop_refined: self.loan_drop_refined.diff(rhs.loan_drop_refined), path_moved: self.path_moved.diff(rhs.path_moved), path_uninitialized: self.path_uninitialized.diff(rhs.path_uninitialized), - permissions: self.permissions.diff(rhs.permissions), + permissions: self.permissions().diff(rhs.permissions()), } } } diff --git a/crates/aquascope/src/test_utils.rs b/crates/aquascope/src/test_utils.rs index aa79994a3..f25f5a3b0 100644 --- a/crates/aquascope/src/test_utils.rs +++ b/crates/aquascope/src/test_utils.rs @@ -272,8 +272,9 @@ pub fn test_refinements_in_file(path: &Path) { let path = ctxt.place_to_path(&place); let point = ctxt.location_to_point(loc); - let computed_perms = - ctxt.permissions_data_at_point(path, point).permissions; + let computed_perms = ctxt + .permissions_data_at_point(path, point) + .permissions_ignore_liveness(); assert!( (*expected_perms == computed_perms), diff --git a/crates/aquascope/tests/snapshots/boundaries__bar@coerced_0.test.snap b/crates/aquascope/tests/snapshots/boundaries__bar@coerced_0.test.snap index 3484ce3f6..189564d8a 100644 --- a/crates/aquascope/tests/snapshots/boundaries__bar@coerced_0.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__bar@coerced_0.test.snap @@ -10,15 +10,15 @@ description: bar@coerced_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 3 column: 29 @@ -27,15 +27,15 @@ description: bar@coerced_0.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - location: line: 4 column: 9 @@ -44,15 +44,15 @@ description: bar@coerced_0.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - location: line: 5 column: 3 @@ -61,13 +61,12 @@ description: bar@coerced_0.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - diff --git a/crates/aquascope/tests/snapshots/boundaries__foo@mut_assign.test.snap b/crates/aquascope/tests/snapshots/boundaries__foo@mut_assign.test.snap index 5687cbcc4..53e2d59ab 100644 --- a/crates/aquascope/tests/snapshots/boundaries__foo@mut_assign.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__foo@mut_assign.test.snap @@ -10,13 +10,12 @@ description: foo@mut_assign.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - diff --git a/crates/aquascope/tests/snapshots/boundaries__get_first@type-driven-flows.test.snap b/crates/aquascope/tests/snapshots/boundaries__get_first@type-driven-flows.test.snap index ab3957700..7dbae6622 100644 --- a/crates/aquascope/tests/snapshots/boundaries__get_first@type-driven-flows.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__get_first@type-driven-flows.test.snap @@ -10,15 +10,15 @@ description: get_first@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false expecting_flow: is_violation: false flow_context: @@ -29,7 +29,7 @@ description: get_first@type-driven-flows.test line: 16 column: 20 filename: - private: 0 + private_use_as_methods_instead: 0 kind: Ok - location: line: 17 @@ -39,15 +39,15 @@ description: get_first@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false expecting_flow: is_violation: false flow_context: @@ -58,6 +58,5 @@ description: get_first@type-driven-flows.test line: 17 column: 7 filename: - private: 0 + private_use_as_methods_instead: 0 kind: Ok - diff --git a/crates/aquascope/tests/snapshots/boundaries__get_first_constrained@type-driven-flows.test.snap b/crates/aquascope/tests/snapshots/boundaries__get_first_constrained@type-driven-flows.test.snap index 2ca6d899e..ff2b1c716 100644 --- a/crates/aquascope/tests/snapshots/boundaries__get_first_constrained@type-driven-flows.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__get_first_constrained@type-driven-flows.test.snap @@ -10,15 +10,15 @@ description: get_first_constrained@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 28 column: 2 @@ -27,15 +27,15 @@ description: get_first_constrained@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false expecting_flow: is_violation: false flow_context: @@ -46,6 +46,5 @@ description: get_first_constrained@type-driven-flows.test line: 28 column: 7 filename: - private: 0 + private_use_as_methods_instead: 0 kind: Ok - diff --git a/crates/aquascope/tests/snapshots/boundaries__get_first_specified@type-driven-flows.test.snap b/crates/aquascope/tests/snapshots/boundaries__get_first_specified@type-driven-flows.test.snap index c999bc2d8..36c3e20b9 100644 --- a/crates/aquascope/tests/snapshots/boundaries__get_first_specified@type-driven-flows.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__get_first_specified@type-driven-flows.test.snap @@ -10,15 +10,15 @@ description: get_first_specified@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false expecting_flow: is_violation: false flow_context: @@ -29,7 +29,7 @@ description: get_first_specified@type-driven-flows.test line: 21 column: 20 filename: - private: 0 + private_use_as_methods_instead: 0 kind: Ok - location: line: 22 @@ -39,15 +39,15 @@ description: get_first_specified@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false expecting_flow: is_violation: false flow_context: @@ -58,6 +58,5 @@ description: get_first_specified@type-driven-flows.test line: 22 column: 7 filename: - private: 0 + private_use_as_methods_instead: 0 kind: Ok - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@assignop_path_resolution.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@assignop_path_resolution.test.snap index 2c52c5f48..475e2aa7d 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@assignop_path_resolution.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@assignop_path_resolution.test.snap @@ -10,15 +10,15 @@ description: main@assignop_path_resolution.test write: false drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 7 column: 10 @@ -27,15 +27,15 @@ description: main@assignop_path_resolution.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 8 column: 2 @@ -44,15 +44,15 @@ description: main@assignop_path_resolution.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: true - is_live: true + is_live: false path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 8 column: 7 @@ -61,6 +61,10 @@ description: main@assignop_path_resolution.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: true type_writeable: true type_copyable: true @@ -68,10 +72,6 @@ description: main@assignop_path_resolution.test path_uninitialized: false loan_write_refined: 0 loan_drop_refined: 0 - permissions: - read: true - write: false - drop: false - location: line: 8 column: 11 @@ -80,15 +80,15 @@ description: main@assignop_path_resolution.test write: false drop: false actual: + read: true + write: false + drop: true + data: type_droppable: true type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: true - location: line: 8 column: 15 @@ -97,13 +97,12 @@ description: main@assignop_path_resolution.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@closure_0.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@closure_0.test.snap index f6881d1a6..9e9f71dd3 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@closure_0.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@closure_0.test.snap @@ -10,15 +10,15 @@ description: main@closure_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 6 column: 2 @@ -27,15 +27,15 @@ description: main@closure_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 7 column: 2 @@ -44,15 +44,15 @@ description: main@closure_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 8 column: 2 @@ -61,15 +61,15 @@ description: main@closure_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 9 column: 17 @@ -78,13 +78,12 @@ description: main@closure_0.test write: false drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@if_0.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@if_0.test.snap index 69ee50ca8..a5c5883d4 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@if_0.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@if_0.test.snap @@ -10,15 +10,15 @@ description: main@if_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 7 column: 9 @@ -27,15 +27,15 @@ description: main@if_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 10 column: 3 @@ -44,15 +44,15 @@ description: main@if_0.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - location: line: 12 column: 4 @@ -61,15 +61,15 @@ description: main@if_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 13 column: 4 @@ -78,13 +78,12 @@ description: main@if_0.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@if_1.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@if_1.test.snap index 8bedef98d..d9c043908 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@if_1.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@if_1.test.snap @@ -10,15 +10,15 @@ description: main@if_1.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 9 column: 13 @@ -27,15 +27,15 @@ description: main@if_1.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 12 column: 3 @@ -44,15 +44,15 @@ description: main@if_1.test write: true drop: false actual: + read: true + write: true + drop: false + data: type_droppable: false type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: false - location: line: 14 column: 4 @@ -61,15 +61,15 @@ description: main@if_1.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - location: line: 15 column: 4 @@ -78,13 +78,12 @@ description: main@if_1.test write: true drop: false actual: + read: true + write: true + drop: true + data: type_droppable: true type_writeable: true type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: true - drop: true - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@match_0.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@match_0.test.snap index 7efa229fa..0cf6715ba 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@match_0.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@match_0.test.snap @@ -10,15 +10,15 @@ description: main@match_0.test write: false drop: false actual: + read: true + write: false + drop: true + data: type_droppable: true type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: true - location: line: 9 column: 7 @@ -27,13 +27,12 @@ description: main@match_0.test write: false drop: true actual: + read: true + write: false + drop: true + data: type_droppable: true type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: true - diff --git a/crates/aquascope/tests/snapshots/boundaries__main@read_on_copy_0.test.snap b/crates/aquascope/tests/snapshots/boundaries__main@read_on_copy_0.test.snap index 6a2bfb697..19b72119e 100644 --- a/crates/aquascope/tests/snapshots/boundaries__main@read_on_copy_0.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__main@read_on_copy_0.test.snap @@ -10,15 +10,15 @@ description: main@read_on_copy_0.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 10 column: 3 @@ -27,15 +27,15 @@ description: main@read_on_copy_0.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 11 column: 3 @@ -44,15 +44,15 @@ description: main@read_on_copy_0.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 12 column: 3 @@ -61,13 +61,12 @@ description: main@read_on_copy_0.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - diff --git a/crates/aquascope/tests/snapshots/boundaries__print_first@type-driven-flows.test.snap b/crates/aquascope/tests/snapshots/boundaries__print_first@type-driven-flows.test.snap index bef31ac4d..6c476eb08 100644 --- a/crates/aquascope/tests/snapshots/boundaries__print_first@type-driven-flows.test.snap +++ b/crates/aquascope/tests/snapshots/boundaries__print_first@type-driven-flows.test.snap @@ -10,15 +10,15 @@ description: print_first@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: false + data: type_droppable: false type_writeable: false type_copyable: false is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: false - location: line: 12 column: 17 @@ -27,13 +27,12 @@ description: print_first@type-driven-flows.test write: false drop: false actual: + read: true + write: false + drop: true + data: type_droppable: true type_writeable: false type_copyable: true is_live: true path_uninitialized: false - permissions: - read: true - write: false - drop: true - diff --git a/crates/aquascope/tests/snapshots/interpreter__basic.test.snap b/crates/aquascope/tests/snapshots/interpreter__basic.test.snap index eb10ea432..f82cc30b0 100644 --- a/crates/aquascope/tests/snapshots/interpreter__basic.test.snap +++ b/crates/aquascope/tests/snapshots/interpreter__basic.test.snap @@ -14,7 +14,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 0 @@ -23,7 +23,7 @@ steps: line: 0 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -38,7 +38,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 1 @@ -47,7 +47,7 @@ steps: line: 1 column: 16 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -67,7 +67,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -76,7 +76,7 @@ steps: line: 2 column: 12 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -101,7 +101,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -110,7 +110,7 @@ steps: line: 3 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -135,7 +135,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 4 @@ -144,10 +144,9 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] result: type: Success - diff --git a/crates/aquascope/tests/snapshots/interpreter__box.test.snap b/crates/aquascope/tests/snapshots/interpreter__box.test.snap index c43d29ce3..0b91fa31b 100644 --- a/crates/aquascope/tests/snapshots/interpreter__box.test.snap +++ b/crates/aquascope/tests/snapshots/interpreter__box.test.snap @@ -14,7 +14,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 0 @@ -23,7 +23,7 @@ steps: line: 0 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -38,7 +38,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 1 @@ -47,7 +47,7 @@ steps: line: 1 column: 26 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -98,7 +98,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -107,7 +107,7 @@ steps: line: 2 column: 10 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -158,7 +158,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -167,7 +167,7 @@ steps: line: 3 column: 12 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -253,7 +253,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 4 @@ -262,10 +262,9 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] result: type: Success - diff --git a/crates/aquascope/tests/snapshots/interpreter__closure.test.snap b/crates/aquascope/tests/snapshots/interpreter__closure.test.snap index 1f35abd2b..ea423bbf8 100644 --- a/crates/aquascope/tests/snapshots/interpreter__closure.test.snap +++ b/crates/aquascope/tests/snapshots/interpreter__closure.test.snap @@ -14,7 +14,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 0 @@ -23,7 +23,7 @@ steps: line: 0 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -38,7 +38,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 1 @@ -47,7 +47,7 @@ steps: line: 1 column: 12 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -67,7 +67,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -76,7 +76,7 @@ steps: line: 2 column: 15 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -116,7 +116,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -125,7 +125,7 @@ steps: line: 3 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -165,7 +165,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -174,7 +174,7 @@ steps: line: 3 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -210,7 +210,7 @@ steps: line: 2 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -219,7 +219,7 @@ steps: line: 2 column: 12 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -234,7 +234,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -243,7 +243,7 @@ steps: line: 3 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -279,7 +279,7 @@ steps: line: 2 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -288,7 +288,7 @@ steps: line: 2 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: (return) value: @@ -308,7 +308,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -317,7 +317,7 @@ steps: line: 3 column: 14 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -362,7 +362,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 4 @@ -371,10 +371,9 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] result: type: Success - diff --git a/crates/aquascope/tests/snapshots/interpreter__nested-ref.test.snap b/crates/aquascope/tests/snapshots/interpreter__nested-ref.test.snap index d75985c90..979b80fe8 100644 --- a/crates/aquascope/tests/snapshots/interpreter__nested-ref.test.snap +++ b/crates/aquascope/tests/snapshots/interpreter__nested-ref.test.snap @@ -14,7 +14,7 @@ steps: line: 3 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 0 @@ -23,7 +23,7 @@ steps: line: 0 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -38,7 +38,7 @@ steps: line: 3 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 1 @@ -47,7 +47,7 @@ steps: line: 1 column: 27 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -81,7 +81,7 @@ steps: line: 3 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -90,7 +90,7 @@ steps: line: 2 column: 18 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -141,7 +141,7 @@ steps: line: 3 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -150,10 +150,9 @@ steps: line: 3 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] result: type: Success - diff --git a/crates/aquascope/tests/snapshots/interpreter__stackref.test.snap b/crates/aquascope/tests/snapshots/interpreter__stackref.test.snap index a4e395eba..3f5073d2e 100644 --- a/crates/aquascope/tests/snapshots/interpreter__stackref.test.snap +++ b/crates/aquascope/tests/snapshots/interpreter__stackref.test.snap @@ -14,7 +14,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 0 @@ -23,7 +23,7 @@ steps: line: 0 column: 9 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] @@ -38,7 +38,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 1 @@ -47,7 +47,7 @@ steps: line: 1 column: 16 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -67,7 +67,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 2 @@ -76,7 +76,7 @@ steps: line: 2 column: 17 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -109,7 +109,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 3 @@ -118,7 +118,7 @@ steps: line: 3 column: 10 filename: - private: 0 + private_use_as_methods_instead: 0 locals: - name: x value: @@ -151,7 +151,7 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 location: start: line: 4 @@ -160,10 +160,9 @@ steps: line: 4 column: 1 filename: - private: 0 + private_use_as_methods_instead: 0 locals: [] heap: locations: [] result: type: Success - diff --git a/frontend/packages/aquascope-editor/src/editor-utils/boundaries.tsx b/frontend/packages/aquascope-editor/src/editor-utils/boundaries.tsx index b4e11448d..033d7519e 100644 --- a/frontend/packages/aquascope-editor/src/editor-utils/boundaries.tsx +++ b/frontend/packages/aquascope-editor/src/editor-utils/boundaries.tsx @@ -115,14 +115,14 @@ let PermStack = ({ facts: AnalysisFacts; boundary: PermissionsBoundary; }) => { - const data = boundary.actual; + const data = boundary.data; let allIcons: (PermCharProps & { exp: boolean })[] = [ { content: readChar, names: ["perm", "read"], exp: boundary.expected.read, - act: data.permissions.read, + act: boundary.actual.read, showit: () => { showLoanRegion(facts, data.loan_read_refined, ["read"]); showMoveRegion(facts, data.path_moved, ["read"]); @@ -136,7 +136,7 @@ let PermStack = ({ content: writeChar, names: ["perm", "write"], exp: boundary.expected.write, - act: data.permissions.write, + act: boundary.actual.write, showit: () => { showLoanRegion(facts, data.loan_write_refined, ["write"]); showMoveRegion(facts, data.path_moved, ["write"]); @@ -150,7 +150,7 @@ let PermStack = ({ content: ownChar, names: ["perm", "own"], exp: boundary.expected.drop, - act: data.permissions.drop, + act: boundary.actual.drop, showit: () => { showLoanRegion(facts, data.loan_drop_refined, ["own"]); showMoveRegion(facts, data.path_moved, ["own"]); @@ -164,7 +164,7 @@ let PermStack = ({ content: flowChar, names: ["perm", "flow"], exp: boundary.expecting_flow !== undefined, - act: !boundary.expecting_flow?.is_violation ?? false, + act: !(boundary.expecting_flow?.is_violation ?? false), showit: () => void null, hideit: () => void null }