File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ new_key_type! {
1414}
1515
1616/// Internal storage for a single value cell; fields are used by `Sheet` (added in a later task).
17- #[ allow( dead_code) ]
1817pub ( crate ) struct CellData {
1918 /// The type-erased current value.
2019 pub ( crate ) value : Box < dyn Any > ,
Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ use std::any::TypeId;
66#[ derive( Debug ) ]
77#[ non_exhaustive]
88pub enum Error {
9- /// A value's `TypeId` did not match the cell's registered `TypeId`.
9+ /// A value's TypeId did not match the cell's registered TypeId.
10+ ///
11+ /// - `expected`: the TypeId registered when the cell was created.
12+ /// - `found`: the TypeId of the value or declaration supplied by the caller.
1013 TypeMismatch {
11- /// The expected type ID .
14+ /// The TypeId registered when the cell was created .
1215 expected : TypeId ,
13- /// The actual type ID found .
16+ /// The TypeId of the value or declaration supplied by the caller .
1417 found : TypeId ,
1518 } ,
1619
@@ -61,6 +64,24 @@ impl std::error::Error for Error {
6164mod tests {
6265 use super :: * ;
6366
67+ #[ test]
68+ fn type_mismatch_fields_convention ( ) {
69+ use std:: any:: TypeId ;
70+ let expected = TypeId :: of :: < i32 > ( ) ;
71+ let found = TypeId :: of :: < f64 > ( ) ;
72+ let e = Error :: TypeMismatch { expected, found } ;
73+ match e {
74+ Error :: TypeMismatch {
75+ expected : e,
76+ found : f,
77+ } => {
78+ assert_eq ! ( e, TypeId :: of:: <i32 >( ) ) ;
79+ assert_eq ! ( f, TypeId :: of:: <f64 >( ) ) ;
80+ }
81+ _ => panic ! ( "wrong variant" ) ,
82+ }
83+ }
84+
6485 #[ test]
6586 fn type_mismatch_display_contains_type_mismatch ( ) {
6687 let err = Error :: TypeMismatch {
Original file line number Diff line number Diff line change 1010//!
1111//! # Example
1212//!
13- //! ```rust,ignore
13+ //! ```rust
1414//! use property_model::{Sheet, Method};
1515//!
1616//! let mut sheet = Sheet::new();
Original file line number Diff line number Diff line change 44//! strength (write-recency clock value) of the method's output cells — preferring to
55//! derive cells that were written least recently. Phase 2 runs Kahn's algorithm to
66//! produce a dependency-ordered execution sequence.
7+ //!
8+ //! The greedy Phase 1 selection is per-relationship with no global optimality guarantee;
9+ //! it minimises the minimum output-cell strength locally but does not guarantee that the
10+ //! globally strongest cell is preserved across the whole sheet. A future model checker
11+ //! will verify solvability.
712
813use std:: collections:: { HashMap , HashSet , VecDeque } ;
914
Original file line number Diff line number Diff line change @@ -111,10 +111,10 @@ impl Method {
111111}
112112
113113/// Internal storage for a relationship; fields are used by `Sheet` (added in a later task).
114- #[ allow( dead_code) ]
115114pub ( crate ) struct RelationshipData {
116115 pub ( crate ) methods : Vec < Method > ,
117116 /// Union of all cell IDs referenced by any method in this relationship.
117+ #[ expect( dead_code, reason = "adj is reserved for the future model checker" ) ]
118118 pub ( crate ) adj : Vec < CellId > ,
119119}
120120
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ impl Sheet {
221221
222222 /// Runs the planning pass and executes the selected methods.
223223 ///
224+ /// Clears the changed-cell set from the previous `propagate()` call before planning.
224225 /// After propagation, call [`Sheet::changed`] to inspect which cells were updated,
225226 /// and [`Sheet::clear_changed`] when done.
226227 ///
You can’t perform that action at this time.
0 commit comments