Skip to content

Commit 2293e78

Browse files
committed
Fix indentation of throws without result type
Example: ```swift func f() throws func g(f: () throws -> Int) rethrows func h() ``` Fix #172.
1 parent 5074a02 commit 2293e78

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

swift-mode-lexer.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Return nil otherwise."
430430
;; Suppress implicit semicolon around keywords that cannot start or end
431431
;; statements.
432432
(member (swift-mode:token:text previous-token)
433-
'("some" "inout" "throws" "rethrows" "in" "where"))
433+
'("some" "inout" "in" "where"))
434434
(member (swift-mode:token:text next-token)
435435
'("some" "inout" "throws" "rethrows" "in" "where")))
436436
nil)

test/swift-files/indent/declarations.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,9 @@ struct Foo
573573
// Protocol declarations
574574

575575
protocol Foo {
576-
func foo(x, y) throws -> (A, B)
576+
func foo(x: Int, y: Int) throws -> (A, B)
577+
func bar(x: Int) throws
578+
func baz(x: () throws -> Int) rethrows
577579
init<A, B>(x: Int) throws
578580
where
579581
A: C

0 commit comments

Comments
 (0)