Avatar
takasekさんがツイートしてたリンクで知ったんですけど、yieldが複数あるかのチェックってSILOptimizerのPassで診断してるんですね $ swiftc yield.swift -emit-sil Run module pass #0, stage Guaranteed Passes, pass 0: SILGenCleanup (silgen-cleanup) Start function passes at stage: Guaranteed Passes Run #1, stage Guaranteed Passes, pass 1: DiagnoseInvalidEscapingCaptures (diagnose-invalid-escaping-captures), Function: $s5yield4NekoC4_bow33_BFC072E4B657A1986E9E174ACA620350LLSSvpfi Run #2, stage Guaranteed Passes, pass 2: DiagnoseStaticExclusivity (diagnose-static-exclusivity), Function: $s5yield4NekoC4_bow33_BFC072E4B657A1986E9E174ACA620350LLSSvpfi Run #3, stage Guaran # 中略 Run #135, stage Guaranteed Passes, pass 20: YieldOnceCheck (yield-once-check), Function: $s5yield4NekoC3bowSSvM yield.swift:9:13: error: accessor must not yield more than once yield &_bow ^ yield.swift:8:13: note: previous yield was here yield &_bow ^ Run #136, stage Guaranteed (edited)
2:13 AM
This pass is based on the existing SIL verifier checks but diagnoses only those errors that can be introduced by programmers. rdar://43578476