Avatar
Extend the mandatory unreachable diagnostic pass to cover naive infinite recursion. The algorithm used is roughly the one from Clang with Swift-specific modifications and some minor simplification...
2:22 AM
時々話題に出てくる循環呼び出しによるスタックオーバーフローをコンパイラで検出する機能のプルリクが立ったよ
2:23 AM
+func a() { // expected-warning {{all paths through this function will call itself}} + a() +} + +func b(_ x : Int) { // expected-warning {{all paths through this function will call itself}} + if x != 0 { + b(x) + } else { + b(x+1) + } +}
2:24 AM
+// Doesn't warn on mutually recursive functions + +func e() { f() } +func f() { e() } とりあえず相互再帰はだめみたい