Conversation
…-divide) was producing a "stack type mismatch" error for Make-Ok, not an "if/else branch mismatch" error. This different error path wasn't including line information. Additional changes made: 1. typechecker.rs - Updated infer_word_call and apply_effect to accept a span parameter 2. typechecker.rs - The "stack type mismatch" error now includes "at line N:" The error now correctly shows: Error: at line 10: Make-Ok: stack type mismatch... Instead of the previous: Error: Make-Ok: stack type mismatch... The LSP has been rebuilt. Please restart your language server to pick up the changes.
PR Review: Fix LSP Line Number ReportingSummaryThis PR successfully addresses line number reporting issues in LSP diagnostics by threading span information through the AST and typechecker. The implementation is well-structured and includes comprehensive test coverage. ✅ Strengths1. Systematic Approach
2. Excellent Test CoverageThe three new integration tests in diagnostics.rs are exemplary (lines 640-668, 700-734, 736-769). Each validates both error message content AND correct line numbers. 3. Documentation
4. Non-Breaking Changes
🔍 Code Quality ObservationsParser Changes (parser.rs:518-755)Good: Captures line/column at the right moment. Span sizes are appropriate (2 for if, 5 for match). Typechecker Changes (typechecker.rs:709-1236)Good: Conditional line formatting, graceful fallbacks, informative error messages. Minor Concern: Line info formatting is duplicated in 3 places. Consider extracting to a helper method (non-blocking). Diagnostic Structure (diagnostics.rs:823-830)Good: Improved structure ensures editor compatibility. The test_diagnostic_structure() test is excellent for debugging. 🐛 Potential Issues1. Line Number IndexingVerify that Span stores 0-indexed line numbers. The code uses s.line + 1 consistently, but this should be documented on the Span type definition. 2. Ignored SpansMany locations use span: _ to ignore the field. Consider whether any might benefit from span info for future diagnostics. 🔐 Security & ⚡ Performance
📝 Suggestions (Non-blocking)
🎯 Final AssessmentRecommendation: ✅ APPROVE with minor suggestions This PR successfully fixes the line number reporting issue in a clean, maintainable way. Excellent test coverage gives confidence the fix works correctly. Minor suggestions above are optimizations, not blockers. Particularly Good:
Great work improving developer experience with better error messages! 🎉 |
PR Review: Fix LSPSummaryThis PR improves LSP error reporting by adding source span information to AST nodes ( Code Quality: ✅ StrongStrengths:
Code patterns align well with CONTRIBUTING.md principles:
Test Coverage: ✅ ExcellentThe PR includes 4 new comprehensive tests in
Tests also include helpful assertions with debug output, making failures easy to diagnose. Test fixes in REPL: Added Potential Issues:
|
PR Review: Fix LSPSummaryThis PR enhances error reporting in the LSP by adding source span tracking to AST nodes ( Code Quality ✅Strengths:
Adherence to project conventions:
Test Coverage ✅Excellent test additions in
These tests verify that:
Test maintenance:
Potential Issues & Suggestions1. Parser span collection (crates/compiler/src/parser.rs)The parser now captures span information: fn parse_if(&mut self, start_line: usize, start_column: usize)
fn parse_match(&mut self, start_line: usize, start_column: usize)
fn parse_match_arm(&mut self) -> Result<MatchArm, String>✅ This looks correct. The span points to the keyword ( 2. Error message formatting (crates/compiler/src/typechecker.rs)The enhanced error messages conditionally include line numbers: if if_line > 0 {
format!("at line {}: if/else branches...", if_line, ...)
} else {
format!("if/else branches...", ...)
}Question: Why the conditional formatting? If
3. Example file addition (examples/language/unions.seq)
4. LSP diagnostic improvements (crates/lsp/src/diagnostics.rs:862-867)code: Some(tower_lsp::lsp_types::NumberOrString::String(
"type-error".to_string(),
)),
source: Some("seqc".to_string()), // Changed from "seq"Note: The source changed from Security Concerns ✅No security issues identified. The changes are purely about improving error reporting metadata. Performance Considerations ✅Minimal overhead:
Minor Observations
Recommendations
Overall AssessmentStrong PR 🎉 This is a well-executed enhancement that significantly improves the developer experience by providing precise error locations. The implementation is:
The addition of the comprehensive Recommendation: Approve with minor clarifications requested above. Review generated with Claude Code |
No description provided.