Skip to content

Commit cb4ded9

Browse files
authored
Merge pull request #139 from ikesyo/dont-use-noreturn
Don't use `@noreturn` to avoid source breaking changes in Swift 3
2 parents 53a8baf + aca99f8 commit cb4ded9

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

Sources/Builder.swift

+26-26
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,79 @@
99
// MARK: Builder
1010

1111
@available(*, unavailable, message="Use the given initializer directly instead")
12-
@noreturn public func build<A, Value>(create: (A) -> Value) -> (A) -> Value {}
12+
public func build<A, Value>(create: (A) -> Value) -> (A) -> Value { fatalError() }
1313

1414
@available(*, unavailable, message="Use the given initializer directly instead")
15-
@noreturn public func build<A, B, Value>(create: (A, B) -> Value) -> (A, B) -> Value {}
15+
public func build<A, B, Value>(create: (A, B) -> Value) -> (A, B) -> Value { fatalError() }
1616

1717
@available(*, unavailable, message="Use the given initializer directly instead")
18-
@noreturn public func build<A, B, C, Value>(create: (A, B, C) -> Value) -> (A, B, C) -> Value {}
18+
public func build<A, B, C, Value>(create: (A, B, C) -> Value) -> (A, B, C) -> Value { fatalError() }
1919

2020
@available(*, unavailable, message="Use the given initializer directly instead")
21-
@noreturn public func build<A, B, C, D, Value>(create: (A, B, C, D) -> Value) -> (A, B, C, D) -> Value {}
21+
public func build<A, B, C, D, Value>(create: (A, B, C, D) -> Value) -> (A, B, C, D) -> Value { fatalError() }
2222

2323
@available(*, unavailable, message="Use the given initializer directly instead")
24-
@noreturn public func build<A, B, C, D, E, Value>(create: (A, B, C, D, E) -> Value) -> (A, B, C, D, E) -> Value {}
24+
public func build<A, B, C, D, E, Value>(create: (A, B, C, D, E) -> Value) -> (A, B, C, D, E) -> Value { fatalError() }
2525

2626
@available(*, unavailable, message="Use the given initializer directly instead")
27-
@noreturn public func build<A, B, C, D, E, F, Value>(create: (A, B, C, D, E, F) -> Value) -> (A, B, C, D, E, F) -> Value {}
27+
public func build<A, B, C, D, E, F, Value>(create: (A, B, C, D, E, F) -> Value) -> (A, B, C, D, E, F) -> Value { fatalError() }
2828

2929
@available(*, unavailable, message="Use the given initializer directly instead")
30-
@noreturn public func build<A, B, C, D, E, F, G, Value>(create: (A, B, C, D, E, F, G) -> Value) -> (A, B, C, D, E, F, G) -> Value {}
30+
public func build<A, B, C, D, E, F, G, Value>(create: (A, B, C, D, E, F, G) -> Value) -> (A, B, C, D, E, F, G) -> Value { fatalError() }
3131

3232
@available(*, unavailable, message="Use the given initializer directly instead")
33-
@noreturn public func build<A, B, C, D, E, F, G, H, Value>(create: (A, B, C, D, E, F, G, H) -> Value) -> (A, B, C, D, E, F, G, H) -> Value {}
33+
public func build<A, B, C, D, E, F, G, H, Value>(create: (A, B, C, D, E, F, G, H) -> Value) -> (A, B, C, D, E, F, G, H) -> Value { fatalError() }
3434

3535
@available(*, unavailable, message="Use the given initializer directly instead")
36-
@noreturn public func build<A, B, C, D, E, F, G, H, I, Value>(create: (A, B, C, D, E, F, G, H, I) -> Value) -> (A, B, C, D, E, F, G, H, I) -> Value {}
36+
public func build<A, B, C, D, E, F, G, H, I, Value>(create: (A, B, C, D, E, F, G, H, I) -> Value) -> (A, B, C, D, E, F, G, H, I) -> Value { fatalError() }
3737

3838
@available(*, unavailable, message="Use the given initializer directly instead")
39-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, Value>(create: (A, B, C, D, E, F, G, H, I, J) -> Value) -> (A, B, C, D, E, F, G, H, I, J) -> Value {}
39+
public func build<A, B, C, D, E, F, G, H, I, J, Value>(create: (A, B, C, D, E, F, G, H, I, J) -> Value) -> (A, B, C, D, E, F, G, H, I, J) -> Value { fatalError() }
4040

4141
@available(*, unavailable, message="Use the given initializer directly instead")
42-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, Value>(create: (A, B, C, D, E, F, G, H, I, J, K) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K) -> Value {}
42+
public func build<A, B, C, D, E, F, G, H, I, J, K, Value>(create: (A, B, C, D, E, F, G, H, I, J, K) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K) -> Value { fatalError() }
4343

4444
@available(*, unavailable, message="Use the given initializer directly instead")
45-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L) -> Value {}
45+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L) -> Value { fatalError() }
4646

4747
@available(*, unavailable, message="Use the given initializer directly instead")
48-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M) -> Value {}
48+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M) -> Value { fatalError() }
4949

5050
@available(*, unavailable, message="Use the given initializer directly instead")
51-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N) -> Value {}
51+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N) -> Value { fatalError() }
5252

5353
@available(*, unavailable, message="Use the given initializer directly instead")
54-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) -> Value {}
54+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) -> Value { fatalError() }
5555

5656
@available(*, unavailable, message="Use the given initializer directly instead")
57-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) -> Value {}
57+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) -> Value { fatalError() }
5858

5959
@available(*, unavailable, message="Use the given initializer directly instead")
60-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) -> Value {}
60+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) -> Value { fatalError() }
6161

6262
@available(*, unavailable, message="Use the given initializer directly instead")
63-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) -> Value {}
63+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) -> Value { fatalError() }
6464

6565
@available(*, unavailable, message="Use the given initializer directly instead")
66-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) -> Value {}
66+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) -> Value { fatalError() }
6767

6868
@available(*, unavailable, message="Use the given initializer directly instead")
69-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) -> Value {}
69+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) -> Value { fatalError() }
7070

7171
@available(*, unavailable, message="Use the given initializer directly instead")
72-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) -> Value {}
72+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) -> Value { fatalError() }
7373

7474
@available(*, unavailable, message="Use the given initializer directly instead")
75-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) -> Value {}
75+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) -> Value { fatalError() }
7676

7777
@available(*, unavailable, message="Use the given initializer directly instead")
78-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W) -> Value {}
78+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W) -> Value { fatalError() }
7979

8080
@available(*, unavailable, message="Use the given initializer directly instead")
81-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X) -> Value {}
81+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X) -> Value { fatalError() }
8282

8383
@available(*, unavailable, message="Use the given initializer directly instead")
84-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y) -> Value {}
84+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y) -> Value { fatalError() }
8585

8686
@available(*, unavailable, message="Use the given initializer directly instead")
87-
@noreturn public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) -> Value {}
87+
public func build<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Value>(create: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) -> Value) -> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) -> Value { fatalError() }

Sources/decode.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public func decodeDictionary<T: Decodable>(JSON: AnyJSON, rootKeyPath: KeyPath)
4040

4141
/// - Throws: DecodeError
4242
@available(*, unavailable, renamed="decodeValue")
43-
@noreturn public func decode<T: Decodable>(JSON: AnyJSON) throws -> T {}
43+
public func decode<T: Decodable>(JSON: AnyJSON) throws -> T { fatalError() }
4444

4545
/// - Throws: DecodeError
4646
@available(*, unavailable, renamed="decodeValue")
47-
@noreturn public func decode<T: Decodable>(JSON: AnyJSON, rootKeyPath: KeyPath) throws -> T {}
47+
public func decode<T: Decodable>(JSON: AnyJSON, rootKeyPath: KeyPath) throws -> T { fatalError() }

0 commit comments

Comments
 (0)