Skip to content

Commit 6ae4f59

Browse files
authored
Merge pull request #20 from lazy-fortran/fix-issue-9-dead-code-tests
Fix dead code detection tests (Issue #9)
2 parents 4b190df + 79c2c9a commit 6ae4f59

File tree

4 files changed

+574
-155
lines changed

4 files changed

+574
-155
lines changed

ISSUE_TRACKING.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Issue Tracking for Test Failures
2+
3+
## Dead Code Detection (Issue #9) - ✅ CLOSED AS SUBSTANTIALLY COMPLETE (97.22%)
4+
5+
### Final Status: Issue #9 is CLOSED. 35/36 tests passing.
6+
7+
1.**Code in impossible conditional (.false. condition)** - **NOW PASSING!**
8+
- **Status**: Fixed by fortfront updates
9+
- **Description**: AST now properly identifies literal false conditions in if statements
10+
11+
2.**Unused internal procedure detection** - **NOW PASSING!**
12+
- **Status**: Fixed by integrating call_graph_t API with targeted procedure detection
13+
- **Description**: Successfully detects unused_sub as unused internal procedure
14+
15+
3.**Unused module procedure detection** - **NOW PASSING!**
16+
- **Status**: Fixed by integrating call_graph_t API with targeted procedure detection
17+
- **Description**: Successfully detects unused_proc as unused module procedure
18+
19+
4.**Recursive procedure analysis** - **NOW PASSING!**
20+
- **Status**: Fixed by removing incorrect hardcoded `factorial` detection
21+
- **Description**: Call graph correctly detected `factorial` as used in `print *, factorial(5)`
22+
23+
5. **Early return pattern analysis** - **BLOCKED by fortfront AST limitation**
24+
- **Status**: Filed fortfront issue #163 for AST parent-child relationships
25+
- **Description**: Cannot determine if return/stop is conditional or unconditional
26+
- **Root Cause**: AST nodes inside conditional blocks have `parent_index = 0`
27+
- **Impact**: This single test represents the 2.78% failure rate
28+
29+
## Other Test Failures
30+
31+
### Fluff Implementation Issues (Need new fluff issues)
32+
33+
1. **test_configuration_reload** (95% passing)
34+
- **Issue**: Missing `validation_result_t%error_message` field
35+
- **Priority**: Low (mostly working)
36+
37+
2. **test_dependency_analysis** (RED phase)
38+
- **Issue**: Placeholder implementation, needs full dependency analyzer
39+
- **Priority**: Medium
40+
- **Related**: Issue #17 (incremental analysis)
41+
42+
3. **test_file_watching** (RED phase)
43+
- **Issue**: Missing file watcher infrastructure (`file_watcher_t`)
44+
- **Priority**: High for IDE integration
45+
46+
4. **test_format_validation** (61% passing)
47+
- **Issue**: Missing advanced formatter validation methods
48+
- **Priority**: Medium
49+
- **Related**: Issue #19 (advanced formatting)
50+
51+
5. **test_formatter_advanced** (failing)
52+
- **Issue**: Missing AST formatting helpers
53+
- **Priority**: Medium
54+
- **Related**: Issue #19 (advanced formatting)
55+
56+
6. **test_formatter_framework****PASSING**
57+
- No issues needed
58+
59+
7. **test_incremental_analysis** (RED phase)
60+
- **Issue**: Missing incremental analyzer infrastructure
61+
- **Priority**: High
62+
- **Related**: Issue #17 (already exists)
63+
64+
8. **test_intelligent_caching** (RED phase)
65+
- **Issue**: Missing caching infrastructure (`analysis_cache_t`)
66+
- **Priority**: High
67+
- **Related**: Issue #14 (already exists)
68+
69+
9. **test_integration_quality** (RED phase)
70+
- **Issue**: Missing integration infrastructure
71+
- **Priority**: Low (nice to have)
72+
73+
### LSP Test Failures (Need fluff issues)
74+
75+
All LSP tests (19% passing average) need implementation:
76+
77+
1. **test_lsp_hover** (19% passing)
78+
- **Related**: Issue #15 (already exists)
79+
80+
2. **test_lsp_diagnostics** (RED phase)
81+
- **Issue**: Missing LSP diagnostic provider
82+
- **Priority**: High for IDE integration
83+
84+
3. **test_lsp_document_sync** (RED phase)
85+
- **Issue**: Missing document synchronization
86+
- **Priority**: High for IDE integration
87+
88+
4. **test_lsp_goto_definition** (RED phase)
89+
- **Issue**: Missing goto definition provider
90+
- **Priority**: Medium
91+
92+
5. **test_lsp_message_handling** (RED phase)
93+
- **Issue**: Missing LSP message handler
94+
- **Priority**: High (core LSP functionality)
95+
96+
6. **test_lsp_code_actions** (RED phase)
97+
- **Issue**: Missing code actions provider
98+
- **Priority**: Low
99+
100+
## Summary
101+
102+
### Existing Issues That Cover Failures:
103+
- Issue #9: Dead code detection (88.89% complete)
104+
- Issue #14: Intelligent caching (covers test_intelligent_caching)
105+
- Issue #15: LSP hover (covers test_lsp_hover)
106+
- Issue #17: Incremental analysis (covers test_incremental_analysis)
107+
- Issue #19: Advanced formatting (covers test_formatter_advanced)
108+
109+
### New fortfront Issues Needed (Updated):
110+
111+
#### Missing Public API Functions:
112+
1. **get_identifiers_in_subtree** - Extract all identifier names from an AST subtree
113+
2. **get_declaration_info** - Get variable names, type specs, and attributes from declaration nodes
114+
3. **get_identifier_name** - Extract the name string from an identifier node
115+
4. **get_assignment_indices** - Get target and value indices from assignment nodes
116+
5. **get_binary_op_info** - Get left/right operand indices and operator from binary op nodes
117+
118+
#### Missing AST Node Field Access:
119+
6. **Node member access** - Cannot access fields like `base_index`, `arg_indices` etc. from AST nodes in select type constructs
120+
- Affects: call_or_subscript_node, subroutine_call_node, print_statement_node, if_node, do_loop_node, etc.
121+
122+
#### Original Issues Still Needed:
123+
7. Constant folding for if conditions (detect if(.false.) at compile time)
124+
8. Call graph analysis for internal procedures
125+
9. Cross-module usage tracking
126+
10. Control flow graph with early returns
127+
128+
### New fluff Issues Needed (7):
129+
1. File watching infrastructure
130+
2. Dependency analysis implementation
131+
3. Format validation methods
132+
4. LSP diagnostic provider
133+
5. LSP document synchronization
134+
6. LSP goto definition provider
135+
7. LSP message handling infrastructure
136+
137+
### Issues That Can Be Closed:
138+
- None currently (Issue #7 already closed)
139+
140+
### Priority Order:
141+
1. **High**: File watching, LSP message handling, LSP diagnostics, LSP document sync
142+
2. **Medium**: Dependency analysis, format validation, LSP goto definition
143+
3. **Low**: Configuration reload fix, integration quality, LSP code actions

fortran_lineage_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Complete FORTRAN/Fortran Historical Lineage
2+
3+
This issue is part of the complete FORTRAN language evolution from 1957 to LazyFortran:
4+
5+
### Fixed-Form Era (Historical - STUBS ONLY)
6+
1. **FORTRAN (1957)** - Original IBM 704 language *(STUB)*
7+
2. **FORTRAN II (1958)** - Procedures and functions *(STUB)*
8+
3. **FORTRAN IV (1962)** - Logical IF, DATA statements *(STUB)*
9+
4. **FORTRAN 66 (1966)** - First ANSI standard *(STUB)*
10+
5. **FORTRAN 77 (1977)** - CHARACTER type, IF-THEN-ELSE *(STUB)*
11+
12+
### Free-Form Era (Modern - ACTIVE DEVELOPMENT)
13+
6. **Fortran 90 (1990)** - Free-form source, modules, pointers **[HIGH PRIORITY]**
14+
7. **Fortran 95 (1995)** - FORALL, WHERE, pure procedures
15+
8. **Fortran 2003 (2003)** - Object-oriented programming, C interoperability
16+
9. **Fortran 2008 (2008)** - Coarrays, submodules
17+
10. **Fortran 2018 (2018)** - Error handling, parallel constructs
18+
11. **Fortran 2023 (2023)** - Latest standard features
19+
12. **LazyFortran** - Type inference and modern syntax (extends F2023)
20+
21+
### Development Strategy
22+
- **Phase 1**: Complete Fortran 90-2023 + LazyFortran (free-form)
23+
- **Phase 2**: Add fixed-form implementations for historical standards (optional)
24+
- **Immediate Priority**: Fortran 90 as foundation for modern chain

fpm.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ auto-executables = true
1919
auto-tests = true
2020
auto-examples = true
2121

22+
23+
2224
[install]
2325
library = false
2426

0 commit comments

Comments
 (0)