-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: improve error messages with tsc-style diagnostics #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add Diagnostic class with code, message, file, line, column attributes - Add factory methods: from_type_check_error, from_parse_error, from_scan_error - Add comprehensive tests for all functionality - TR1xxx codes for parser errors, TR2xxx for type errors
- Format errors as file:line:col - severity CODE: message - Display source code snippets with line numbers - Show error markers (~~~) under problem location - Include Expected/Actual/Suggestion context - Support ANSI colors with TTY auto-detection - Format summary line: Found X errors and Y warnings
- Collect multiple diagnostics during compilation - Convert TypeCheckError, ParseError, ScanError to Diagnostic - Auto-load source from file when not provided - Report formatted output using DiagnosticFormatter - Track error vs warning counts
- Use ErrorReporter for TypeCheckError, ParseError, ScanError - Display tsc-style formatted error output - Include source code snippets and error markers - Show Expected/Actual/Suggestion context - Display summary line with error count
- Replace hash-based error format with Diagnostic objects - Use DiagnosticFormatter for consistent tsc-style output - Include source code snippets in watch mode errors - Update tests to expect Diagnostic objects
- TokenDeclarationParser: capture def token's line/column - Parser.parse_function_with_body: add line/column to func_info - Parser.parse_method_in_class: add line/column to method_info - IR CodeGenerator.build_method: pass location to MethodDef Error messages now show exact line:column position: src/file.trb:18:1 - error TR2001: Type mismatch...
- Add @file_diagnostics cache to preserve errors across incremental compiles - Use compile_with_diagnostics consistently in compile_file_with_ir - Add update_file_hash method to EnhancedIncrementalCompiler - Rename file_hash to compute_file_hash (private method) - Fix error count calculation from cached diagnostics - Fix various RuboCop offenses (guard clauses, multiple comparison) This ensures that when saving a file in watch mode, errors from other files are preserved and the total error count remains accurate.
- Add error_handler tests for Float type, unicode identifiers, class scoping - Add colon_spacing tests for hash literal types and keyword arguments - Add compiler tests for compile_with_diagnostics method
- Add method name validation for spaces (TR1003 error) - Add extensive tests for parser_combinator (Lookahead, NotFollowedBy, FlatMap, Pure, Fail, token parsers) - Add comprehensive SMT solver tests (Formula, BoolConst, Variable, Not, And, Or, Implies, Iff, TypeVar, etc.) - Add IR node tests (children methods, TypeNode, LiteralType, HashLiteralType, Visitor) - Add TypeChecker tests (TypeCheckError, TypeHierarchy, FlowContext, validate_type, etc.) - Add new spec files for untested modules: - benchmark_spec.rb, doc_generator_spec.rb - docs_badge_generator_spec.rb, docs_example_extractor_spec.rb, docs_example_verifier_spec.rb - generic_type_parser_spec.rb, intersection_type_parser_spec.rb, union_type_parser_spec.rb - string_utils_spec.rb, type_env_spec.rb, version_checker_spec.rb - Enhance existing specs: ast_type_inferrer, bundler_integration, cache, cli constraint_checker, error_handler, lsp_server, package_manager, type_inferencer, watcher
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Test plan