|
1 | 1 | // RUN: %target-swift-frontend -parse -verify %s -disable-experimental-parser-round-trip
|
2 | 2 |
|
| 3 | +// Array Literal |
| 4 | + |
| 5 | +let values = [1,2,3,] |
| 6 | + |
| 7 | +let values: [Int,] = [] // expected-note {{to match this opening '['}} expected-error {{expected ']' in array type}} expected-error {{expected pattern}} |
| 8 | + |
3 | 9 | // Tuple and Tuple Pattern
|
4 | 10 |
|
5 | 11 | let _ = (a: 1, b: 2, c: 3,)
|
@@ -64,6 +70,45 @@ macro OptionSet<RawType>() = #externalMacro(module: "SwiftMacros", type: "Option
|
64 | 70 |
|
65 | 71 | if #unavailable(iOS 15, watchOS 9,) { }
|
66 | 72 |
|
| 73 | +if #available(iOS 15,) { } // expected-error {{expected platform name}} |
| 74 | + |
| 75 | +// Built-in Attributes |
| 76 | + |
| 77 | +@inline(never,) // expected-error {{expected declaration}} expected-error {{expected ')' in 'inline' attribute}} |
| 78 | +func foo() { } |
| 79 | + |
| 80 | +@available(iOS 15,) // expected-error {{expected platform name}} expected-error {{expected declaration}} |
| 81 | +func foo() { } |
| 82 | + |
| 83 | +@backDeployed(before: SwiftStdlib 6.0,) // expected-error {{unexpected ',' separator}} |
| 84 | +func foo() { } |
| 85 | + |
| 86 | +struct Foo { |
| 87 | + |
| 88 | + var x: Int |
| 89 | + var y: Int |
| 90 | + |
| 91 | + var value: (Int, Int) { |
| 92 | + @storageRestrictions(initializes: x, y,) // expected-error {{expected property name in @storageRestrictions list}} |
| 93 | + init(initialValue) { |
| 94 | + self.x = initialValue.0 |
| 95 | + self.y = initialValue.1 |
| 96 | + } |
| 97 | + get { (x, y) } |
| 98 | + } |
| 99 | + |
| 100 | +} |
| 101 | + |
| 102 | +func f(in: @differentiable(reverse,) (Int) -> Int) { } // expected-warning {{@differentiable' has been renamed to '@differentiable(reverse)' and will be removed in the next release}} expected-error {{unexpected ',' separator}} expected-error {{expected ',' separator}} expected-error {{unnamed parameters must be written with the empty name '_'}} |
| 103 | + |
| 104 | +@derivative(of: Self.other,) // expected-error {{unexpected ',' separator}} |
| 105 | +func foo() {} |
| 106 | + |
| 107 | +@transpose(of: S.instanceMethod,) // expected-error {{unexpected ',' separator}} |
| 108 | +func transposeInstanceMethodWrtSelf(_ other: S, t: S) -> S { |
| 109 | + other + t |
| 110 | +} |
| 111 | + |
67 | 112 | // The following cases are only supported with the 'TrailingComma' experimental feature flag enabled
|
68 | 113 |
|
69 | 114 | // Switch Case Pattern List
|
|
0 commit comments