feat(flow): RN 50/50 전체 통과 — 중첩 함수 타입 + conditional + type guard + infer + keyof + JSX 주석#597
Merged
Conversation
Flow 파서 미지원 구문 4건 추가: 1. 중첩 괄호 함수 타입: ((err: Error) => void), Function | ((a: T) => void) - parseParenOrFunctionType에서 lookahead 기반 판별로 교체 - speculative 파싱의 rollback 문제 해결 2. Conditional type: T extends X ? Y : Z - parseType에서 extends 키워드 감지 후 ? : 분기 파싱 3. Type guard predicate: value is Type - tryParseReturnType에서 'is' contextual keyword 처리 4. Speculative 파싱 안정화: - is_likely_fn lookahead로 불필요한 speculative 시도 제거 - 괄호로 시작하는 타입은 직접 parseType으로 처리 RN fixtures: 43/50 → 47/50 (+4개) 테스트 4개 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Smoke Test Results (CI)Smoke Test Results
Size Comparison (ZTS vs esbuild)
Average ratio: 0.94x | Smaller: 123 | Similar(±10%): 1 | Larger: 8
|
Benchmark Results (CI)macos-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
ubuntu-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
windows-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
|
추가 수정 7건:
1. JSX element 내 // 주석 스킵 (nextInsideJSXElement에서 line/block comment 처리)
2. infer T — conditional type 타입 추론 변수
3. keyof T — 타입 연산자
4. interface {} — inline interface 타입 (balanced brace skip)
5. flow_in_return_type → arrow 파라미터 반환 타입에서만 적용
- 메서드 반환 타입에서 shorthand 함수 타입 허용: (): number => OutputT
- arrow 반환 타입에서 shorthand 금지: (x): any => {} (arrow body)
6. skipBalancedBraces 헬퍼 추가
7. 중첩 괄호 함수 타입 + speculative 파싱 안정화
RN fixtures: 47/50 → 50/50 (전체 통과)
테스트 7개 추가
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…wline - parser.zig: flow_in_return_type 복원에 defer 사용 (에러 경로 플래그 누수 수정) - flow.zig: skipBalancedParens/skipBalancedBraces → skipBalanced(open, close) 통합 - scanner.zig: JSX line comment 뒤 has_newline_before 설정 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
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
Flow 파서를 대폭 강화하여 React Native fixtures 50개 파일 전체 통과를 달성합니다.
수정 내용
((err: Error) => void)T extends X ? Y : Zvalue is Typeinfer T(conditional 타입 추론)keyof T(타입 연산자)interface {}(inline interface 타입)//주석 스킵flow_in_return_type범위 조정skipBalancedBraces헬퍼flow_in_return_type범위 조정tryParseReturnType에서 설정 → 모든 반환 타입에서 shorthand 금지parseTypedArrowParams에서만 설정 → arrow 반환 타입에서만 금지(): number => OutputT는 shorthand 함수 타입으로 정상 파싱RN 호환성
47/50 → 50/50 (전체 통과)
Test plan
zig build test전체 통과flow-rn.test.ts50개 전부 expectPass🤖 Generated with Claude Code