Fix review issues and modernize Go type aliases and workflows#13
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the expression engine to be more Unicode-correct and modern Go idiomatic, while refining interpreter behavior and CI configuration.
Changes:
- Make string length/index/slice operations Unicode-aware (rune-based) in the interpreter and add related tests.
- Modernize public/internal types by replacing
interface{}withanyand improving type-checking behavior for mixed schemas. - Improve logical operator short-circuiting, map membership semantics, lexer string error handling, and CI workflow dependencies.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| typecheck.go | Adds schema merging to better infer array/object item types and propagates unknown more consistently. |
| parser.go | Switches AST Value to any and adds [:] parsing, with slice node value handling updated. |
| lexer.go | Changes string tokenization to return an error on unterminated strings. |
| conversions.go | Adds Unicode-aware string helpers (stringLength, stringIndex, stringSlice) and updates helpers to use any. |
| interpreter.go | Uses rune-aware string ops, refines and/or short-circuiting, and fixes map membership checks for null values. |
| interpreter_test.go | Expands coverage for Unicode string behavior, short-circuiting edge cases, and map membership with null. |
| error.go | Modernizes NewError varargs from ...interface{} to ...any. |
| README.md | Updates examples for any, parser usage, options usage, and documents rune-aware string semantics. |
| .github/workflows/ci.yaml | Updates Actions dependencies and configures Go version via go.mod. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces Unicode-aware string operations to the interpreter, ensuring string length, indexing, and slicing operate on runes rather than raw bytes. Additionally, it updates the codebase to use Go's
anytype instead ofinterface{}for improved readability and modern Go compatibility. The PR also includes enhancements to logical operator evaluation, test coverage for Unicode strings, and workflow dependency updates.Unicode-aware string handling:
Added helper functions (
stringLength,stringIndex,stringSlice) to ensure string length, indexing, and slicing operate on Unicode code points (runes), not bytes. Updated all relevant interpreter logic to use these helpers, which fixes issues with multi-byte characters. [1] [2] [3] [4] [5] F4c5f641L4R4, F4c5f641L4R4, F4c5f641L16R17, F4c5f641L46R47, F4c5f641L84R97, F4c5f641L123R136, F4c5f641L136R149)Updated documentation to clarify that string operations are Unicode-aware, and added related tests for strings with multi-byte characters (e.g., "éclair", "héllo"). [1] [2]
Type and API modernization:
interface{}withanythroughout the codebase and tests for improved clarity and Go 1.18+ idiomatic usage. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Interpreter logic improvements:
and,or) evaluation to use short-circuit logic, ensuring correct behavior when operands are missing or falsy. [1] [2]Test suite enhancements:
nullvalues. [1] [2]CI and documentation updates:
go.mod.These changes collectively improve the correctness, maintainability, and modernity of the codebase, especially for internationalization and Unicode support.