You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: support Unicode method names in parser and compiler (#12)
* test: add failing tests for Unicode method names
Add test cases for non-ASCII method name parsing:
- Korean characters (안녕하세요)
- Mixed ASCII and Unicode (비_영어_함수명___테스트1!)
- Japanese characters (こんにちは)
- Class methods with Unicode names
All tests currently fail due to \w regex pattern limitation.
Related to #11
* fix: support Unicode method names in parser and compiler
Replace \w regex pattern with [\p{L}\p{N}_] to support non-ASCII
characters (Korean, Japanese, etc.) in method names.
Changes:
- Add IDENTIFIER_CHAR and METHOD_NAME_PATTERN constants
- Update parser.rb to detect Unicode method definitions
- Update compiler.rb to strip type annotations from Unicode methods
Fixes#11
* fix: parse conditional expressions for union type inference
Add parse_conditional method to BodyParser that properly parses
if/unless/elsif/else blocks into IR::Conditional nodes. This enables
the type inference system to collect all possible return values from
conditional branches and unify them into union types.
The fix handles:
- Simple if/else blocks
- elsif chains (parsed as nested if)
- unless statements
- Nested conditionals at correct depth
Fixes#13
* fix: ignore unreachable code after return in type inference
Modified collect_returns_recursive to return a termination flag.
When a return statement is encountered, subsequent code in the same
block is now correctly identified as unreachable and excluded from
type inference.
This ensures that methods like:
def test
return false
if condition
"string"
end
end
Are inferred as returning `bool` instead of `bool | String`.
0 commit comments