|
12 | 12 | * Detailed Plan Step 1: Locate the `match &variant.fields` block in `module/core/former_meta/src/derive_former/former_enum.rs`. |
13 | 13 | * Detailed Plan Step 2: **Unit Variant:** Implement logic: Check `wants_subform_scalar` -> Return `syn::Error`. Otherwise (Default/Scalar) -> Generate Direct Constructor (`Enum::variant() -> Enum`). Generate standalone constructor if enabled. |
14 | 14 | * Detailed Plan Step 3: **Tuple Variant (len 0):** Implement logic: Check `wants_subform_scalar` -> Return `syn::Error`. Otherwise (Default/Scalar) -> Generate Direct Constructor (`Enum::variant() -> Enum`). Generate standalone constructor if enabled. |
| 15 | + * Detailed Plan Step 4: **Enable Tests:** Uncomment tests in `tests/inc/former_enum_tests/unit_variant_*.rs` and relevant zero-field tests in `enum_named_fields_*.rs`. |
15 | 16 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
16 | | - * Verification Strategy: Compile checks (`cargo check --package former_meta`). Verify `unit_variant_*` and relevant `enum_named_fields_*` tests pass (specifically `variant_zero_unnamed_*`). |
| 17 | + * Verification Strategy: Compile checks (`cargo check --package former_meta`). Run enabled tests (`cargo test --package former --test former_enum_test unit_variant_*, enum_named_fields_only_test::variant_zero_unnamed_*`). **Analyze logs critically.** |
17 | 18 | * ⚫ Increment 7: Implement Logic for Single-Field Tuple Variants |
18 | 19 | * Goal: Implement and verify logic for Tuple variants with one field. |
19 | 20 | * Detailed Plan Step 1: Locate `Tuple Variant (len 1)` case in `former_enum.rs`. |
20 | 21 | * Detailed Plan Step 2: Implement logic: Check `wants_scalar` and `wants_subform_scalar` -> Error. |
21 | 22 | * Detailed Plan Step 3: If `wants_scalar` -> Generate Direct Constructor (`Enum::variant(InnerType) -> Enum`). Generate standalone constructor if enabled. |
22 | 23 | * Detailed Plan Step 4: Otherwise (Default/`wants_subform_scalar`) -> Generate Subformer Starter (`Enum::variant() -> InnerFormer<...>`), checking path type requirement. Generate `End` struct and `impl FormingEnd`. Generate standalone constructor if enabled. |
| 24 | + * Detailed Plan Step 5: **Enable Tests:** Uncomment tests in `tests/inc/former_enum_tests/basic_*.rs`, `generics_in_tuple_variant_*.rs`, `scalar_generic_tuple_*.rs`. |
23 | 25 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
24 | | - * Verification Strategy: Compile checks. Verify relevant `basic_*` and `generics_in_tuple_variant_*` tests pass. |
| 26 | + * Verification Strategy: Compile checks. Run enabled tests (`cargo test --package former --test former_enum_test basic_*, generics_in_tuple_variant_*, scalar_generic_tuple_*`). **Analyze logs critically.** |
25 | 27 | * ⚫ Increment 8: Implement Logic for Multi-Field Tuple Variants |
26 | 28 | * Goal: Implement and verify logic for Tuple variants with more than one field. |
27 | 29 | * Detailed Plan Step 1: Locate `Tuple Variant (len > 1)` case in `former_enum.rs`. |
28 | 30 | * Detailed Plan Step 2: Implement logic: Check `wants_scalar` and `wants_subform_scalar` -> Error. |
29 | 31 | * Detailed Plan Step 3: If `wants_scalar` -> Generate Direct Constructor (`Enum::variant(T1, T2, ...) -> Enum`). Generate standalone constructor if enabled. |
30 | 32 | * Detailed Plan Step 4: Otherwise (Default/`wants_subform_scalar`) -> Return Error (Subformer not supported for multi-field tuple). |
| 33 | + * Detailed Plan Step 5: **Enable Tests:** Uncomment relevant multi-field tuple tests (if any) in `enum_named_fields_*.rs` or other files. |
31 | 34 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
32 | | - * Verification Strategy: Compile checks. Verify relevant `enum_named_fields_*` tests pass (expecting errors for default multi-field tuple if any exist). |
| 35 | + * Verification Strategy: Compile checks. Run enabled tests (expecting errors for default multi-field tuple if any exist). **Analyze logs critically.** |
33 | 36 | * ⚫ Increment 9: Implement Logic for Zero-Field Struct Variants |
34 | 37 | * Goal: Implement and verify logic for Struct variants with zero fields. |
35 | 38 | * Detailed Plan Step 1: Locate `Struct Variant (len 0)` case in `former_enum.rs`. |
36 | 39 | * Detailed Plan Step 2: Implement logic: Check `wants_subform_scalar` -> Error. |
37 | 40 | * Detailed Plan Step 3: If `wants_scalar` -> Generate Direct Constructor (`Enum::variant {} -> Enum`). Generate standalone constructor if enabled. |
38 | 41 | * Detailed Plan Step 4: Otherwise (Default) -> Return `syn::Error`. |
| 42 | + * Detailed Plan Step 5: **Enable Tests:** Uncomment relevant zero-field struct tests in `enum_named_fields_*.rs`. |
39 | 43 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
40 | | - * Verification Strategy: Compile checks. Verify relevant `enum_named_fields_*` tests pass. |
| 44 | + * Verification Strategy: Compile checks. Run enabled tests (`cargo test --package former --test former_enum_test enum_named_fields_only_test::variant_zero_scalar_*`). **Analyze logs critically.** |
41 | 45 | * ⚫ Increment 10: Implement Logic for Single-Field Struct Variants |
42 | 46 | * Goal: Implement and verify logic for Struct variants with one field. |
43 | 47 | * Detailed Plan Step 1: Locate `Struct Variant (len 1)` case in `former_enum.rs`. |
44 | 48 | * Detailed Plan Step 2: Implement logic: Check `wants_scalar` and `wants_subform_scalar` -> Error. |
45 | 49 | * Detailed Plan Step 3: If `wants_scalar` -> Generate Direct Constructor (`Enum::variant { field: InnerType } -> Enum`). Generate standalone constructor if enabled. |
46 | 50 | * Detailed Plan Step 4: Otherwise (Default/`wants_subform_scalar`) -> Generate Subformer Starter (`Enum::variant() -> InnerFormer<...>`), checking path type requirement. Generate `End` struct and `impl FormingEnd`. Generate standalone constructor if enabled. |
| 51 | + * Detailed Plan Step 5: **Enable Tests:** Uncomment relevant single-field struct tests in `enum_named_fields_*.rs`. |
47 | 52 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
48 | | - * Verification Strategy: Compile checks. Verify relevant `enum_named_fields_*` tests pass. |
| 53 | + * Verification Strategy: Compile checks. Run enabled tests (`cargo test --package former --test former_enum_test enum_named_fields_only_test::variant_one_*`). **Analyze logs critically.** |
49 | 54 | * ⚫ Increment 11: Implement Logic for Multi-Field Struct Variants - Scalar Case |
50 | 55 | * Goal: Implement and verify the `#[scalar]` case for multi-field struct variants. |
51 | 56 | * Detailed Plan Step 1: Locate `Struct Variant (len > 1)` case in `former_enum.rs`. |
52 | 57 | * Detailed Plan Step 2: Implement logic: Check `wants_scalar` and `wants_subform_scalar` -> Error. |
53 | 58 | * Detailed Plan Step 3: If `wants_scalar` -> Generate Direct Constructor (`Enum::variant { f1: T1, ... } -> Enum`). Generate standalone constructor if enabled. |
| 59 | + * Detailed Plan Step 4: **Enable Tests:** Uncomment relevant multi-field scalar struct tests in `enum_named_fields_*.rs`. |
54 | 60 | * Crucial Design Rules: [Handling Panics vs Recoverable Errors](#handling-panics-vs-recoverable-errors). |
55 | | - * Verification Strategy: Compile checks. Verify relevant `enum_named_fields_*` tests pass. |
| 61 | + * Verification Strategy: Compile checks. Run enabled tests (`cargo test --package former --test former_enum_test enum_named_fields_only_test::variant_two_scalar_*`). **Analyze logs critically.** |
56 | 62 | * ⚫ **Increment 12: Multi-Field Struct Variant - Subformer - Storage** |
57 | 63 | * Goal: Generate the implicit storage struct for the default/subform case. |
58 | 64 | * Hypothesis (H2, H6): The storage struct definition with `Option<FieldType>` for each field and `PhantomData` using `phantom::tuple(&enum_generics_ty)` compiles correctly with the necessary `where` clause (`#merged_where_clause`). |
|
97 | 103 | * Goal: Generate the static method on the enum returning the implicit former. |
98 | 104 | * Hypothesis (H1, H7, H6): Return type correctly references implicit former with generics. Body calls `ImplicitFormer::begin` correctly. |
99 | 105 | * Detailed Plan: Implement Step 8h from previous plan. |
100 | | - * Verification Strategy: Compile check. Verify `generics_shared_struct_*` tests now compile (but might fail runtime). |
| 106 | + * Verification Strategy: Compile check. |
101 | 107 | * ⚫ **Increment 21: Multi-Field Struct Variant - Subformer - Standalone Constructor** |
102 | 108 | * Goal: Generate the standalone constructor (if enabled). |
103 | 109 | * Hypothesis (H6): Signature, return type (implicit former/Self), and body are correct based on `arg_for_constructor`. |
104 | 110 | * Detailed Plan: Implement Step 8i from previous plan. |
105 | 111 | * Verification Strategy: Compile check. |
106 | 112 | * ⚫ Increment 22: Update Documentation Comment in `former_enum.rs` (Original Step 9). |
107 | 113 | * ⚫ Increment 23: Verify `generics_shared_struct_*` tests pass. |
108 | | -* ⚫ Increment 24+: Address remaining test files (Renumbered). |
109 | | -* ⚫ Increment N: Update Documentation (`Readme.md`, `advanced.md`). |
110 | | -* ⚫ Increment N+1: Final Verification (Full Test Suite). |
| 114 | + * Goal: Ensure the multi-field struct subformer logic works with generics. |
| 115 | + * Detailed Plan Step 1: **Enable Tests:** Uncomment tests in `tests/inc/former_enum_tests/generics_shared_struct_*.rs`. |
| 116 | + * Verification Strategy: Run enabled tests (`cargo test --package former --test former_enum_test generics_shared_struct_*`). **Analyze logs critically.** |
| 117 | +* ⚫ Increment 24: Verify `generics_independent_struct_*` tests pass. |
| 118 | + * Goal: Ensure the multi-field struct subformer logic works with independent generics. |
| 119 | + * Detailed Plan Step 1: **Enable Tests:** Uncomment tests in `tests/inc/former_enum_tests/generics_independent_struct_*.rs`. |
| 120 | + * Verification Strategy: Run enabled tests (`cargo test --package former --test former_enum_test generics_independent_struct_*`). **Analyze logs critically.** |
| 121 | +* ⚫ Increment 25: Verify `standalone_constructor_*.rs` tests pass. |
| 122 | + * Goal: Ensure standalone constructors work correctly for all implemented variant types. |
| 123 | + * Detailed Plan Step 1: **Enable Tests:** Uncomment tests in `tests/inc/former_enum_tests/standalone_constructor_*.rs` and `standalone_constructor_args_*.rs`. |
| 124 | + * Verification Strategy: Run enabled tests (`cargo test --package former --test former_enum_test standalone_constructor_*`). **Analyze logs critically.** |
| 125 | +* ⚫ Increment 26: Address remaining test files (e.g., `keyword_variant`, `subform_collection_test`). |
| 126 | + * Goal: Enable and fix any remaining enum-related tests. |
| 127 | + * Detailed Plan Step 1: **Enable Tests:** Uncomment remaining test files in `tests/inc/former_enum_tests/`. |
| 128 | + * Verification Strategy: Run enabled tests (`cargo test --package former --test former_enum_test`). **Analyze logs critically.** Fix any failures. |
| 129 | +* ⚫ Increment 27: Update Documentation (`Readme.md`, `advanced.md`). |
| 130 | +* ⚫ Increment 28: Final Verification (Full Test Suite). |
111 | 131 |
|
112 | 132 | ## Notes & Insights |
113 | 133 |
|
|
124 | 144 | * **[2024-04-25/Inc 6 Correction 2]** Fixed regressions related to syntax errors (extra commas) and logic errors (`FormingEnd::call`) in generated code for implicit formers. |
125 | 145 | * **[2024-04-25/Inc 6 Decomposition]** Decomposed Step 8 (Multi-Field Struct Variant - Subformer Case) into smaller sub-steps (8a-8i) to isolate and verify the generation of each implicit former component. Updated plan accordingly. Renumbered subsequent increments. |
126 | 146 | * **[2024-04-25/Inc 6 Hypothesis]** Confirmed hypotheses for implicit former generation for multi-field struct variants. Key points: generate dedicated former ecosystem for the variant, storage holds `Option<FieldType>` for all variant fields, `preform` returns tuple, former has setters for all variant fields, `End::call` uses preformed tuple to construct variant. Generics handling (H6) and `End::call` logic (H8) require careful implementation. |
127 | | -* **[2024-04-25/Inc 6 Plan Revision]** Further decomposed Increment 6. Will now implement logic for each variant type incrementally (Unit, Tuple(0), Tuple(1), Tuple(N), Struct(0), Struct(1), Struct(N)-Scalar). The complex Struct(N)-Subformer case is broken into multiple increments (12-21) based on verified hypotheses. |
| 147 | +* **[2024-04-25/Inc 6 Plan Revision]** Further decomposed Increment 6. Will now implement logic for each variant type incrementally (Unit, Tuple(0), Tuple(1), Tuple(N), Struct(0), Struct(1), Struct(N)-Scalar). The complex Struct(N)-Subformer case is broken into multiple increments (12-21) based on verified hypotheses. |
| 148 | +* **[2024-04-25/Plan Update 2]** Added explicit test enabling steps to increments 6-11, 23-26. Renumbered final increments. |
0 commit comments