branch: elpa/swift-mode commit 2293e78c2c4660e6f3559411f649c4a34eb7e8d8 Author: taku0 <mxxouy6x3m_git...@tatapa.org> Commit: taku0 <mxxouy6x3m_git...@tatapa.org>
Fix indentation of throws without result type Example: ```swift func f() throws func g(f: () throws -> Int) rethrows func h() ``` Fix https://github.com/swift-emacs/swift-mode/issues/172. --- swift-mode-lexer.el | 2 +- test/swift-files/indent/declarations.swift | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el index 00a4c23..f9641bf 100644 --- a/swift-mode-lexer.el +++ b/swift-mode-lexer.el @@ -430,7 +430,7 @@ Return nil otherwise." ;; Suppress implicit semicolon around keywords that cannot start or end ;; statements. (member (swift-mode:token:text previous-token) - '("some" "inout" "throws" "rethrows" "in" "where")) + '("some" "inout" "in" "where")) (member (swift-mode:token:text next-token) '("some" "inout" "throws" "rethrows" "in" "where"))) nil) diff --git a/test/swift-files/indent/declarations.swift b/test/swift-files/indent/declarations.swift index 17dc5b3..1d5e0ba 100644 --- a/test/swift-files/indent/declarations.swift +++ b/test/swift-files/indent/declarations.swift @@ -573,7 +573,9 @@ struct Foo // Protocol declarations protocol Foo { - func foo(x, y) throws -> (A, B) + func foo(x: Int, y: Int) throws -> (A, B) + func bar(x: Int) throws + func baz(x: () throws -> Int) rethrows init<A, B>(x: Int) throws where A: C