File tree Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ func testTrailingClsure() {
104
104
acceptClosures ( x: { } , y: { 12 } ) { }
105
105
}
106
106
107
+ func testInOut( ) {
108
+ func acceptInOut( arg: inout Int ) { arg += 1 }
109
+ var value = 42
110
+ acceptInOut ( arg: & value)
111
+ }
112
+
107
113
func testStringLiteral( arg: Int ) {
108
114
_ = " test "
109
115
_ = " foo \( arg) bar "
@@ -129,3 +135,46 @@ func testStringLiteral(arg: Int) {
129
135
baz
130
136
"""
131
137
}
138
+
139
+ func testNumberLiteral( ) {
140
+ _ = 12
141
+ _ = 1_2
142
+ _ = 0xab
143
+ _ = 0xab _p2
144
+ _ = 12.42
145
+ _ = 0b0000_1100_1000
146
+ _ = 1 _
147
+ _ = 1_000
148
+ _ = 0b1111_0000 _
149
+ _ = 0b1111_0000
150
+ _ = 0o127_777 _
151
+ _ = 0o127_777
152
+ _ = 0x12FF_FFFF
153
+ _ = 0x12FF_FFFF _
154
+ _ = 1.0e42
155
+ _ = 0x1 . 0 p0
156
+ _ = 0x1 . fffffep+ 2
157
+ _ = 1_000.200_001e1_000
158
+ _ = 0x1_0000 . 0 FFF_ABCDp10_001
159
+ }
160
+
161
+ class BaseCls {
162
+ init ( base: Int ) { }
163
+ }
164
+ class DerivedCls : BaseCls {
165
+ init ( testSuperRef arg: Int ) { super. init ( base: arg) }
166
+ }
167
+
168
+ struct HasSubscript {
169
+ subscript( label label: Int , args: Int ) -> Int { return 1 }
170
+ }
171
+ func testSubscript( intArry: [ Int ] , val: HasSubscript ) {
172
+ _ = intArry [ 12 ]
173
+ _ = val [ label: 42 , 14 ]
174
+ }
175
+
176
+ struct Generic < T: Comparable > { }
177
+ func testSpecializeExpr( ) {
178
+ _ = Generic< Int> . self
179
+ _ = Generic < Int > ( )
180
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend %s -dump-parse -enable-bare-slash-regex -enable-experimental-feature ParserASTGen > %t/astgen.ast.raw
3
+ // RUN: %target-swift-frontend %s -dump-parse -enable-bare-slash-regex > %t/cpp-parser.ast.raw
4
+
5
+ // Filter out any addresses in the dump, since they can differ.
6
+ // RUN: sed -E 's#0x[0-9a-fA-F]+##g' %t/cpp-parser.ast.raw > %t/cpp-parser.ast
7
+ // RUN: sed -E 's#0x[0-9a-fA-F]+##g' %t/astgen.ast.raw > %t/astgen.ast
8
+
9
+ // RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast
10
+
11
+ // RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen -enable-bare-slash-regex
12
+
13
+ // REQUIRES: swift_swift_parser
14
+
15
+ // -enable-experimental-feature requires an asserts build
16
+ // REQUIRES: asserts
17
+ // rdar://116686158
18
+ // UNSUPPORTED: asan
19
+
20
+ func testRegexLiteral( ) {
21
+ _ = /abc/
22
+ _ = #/abc/#
23
+ _ = ##/abc/# #
24
+
25
+ func foo< T> ( _ x: T ... ) { }
26
+ foo ( /abc/ , #/abc/#, ##/abc/# #)
27
+
28
+ let _ = [ /abc/ , #/abc/#, ##/abc/# #]
29
+
30
+ _ = /\w+/ . self
31
+ _ = #/\w+/# . self
32
+ _ = ##/\w+/# #. self
33
+
34
+ _ = /#\/ \#\\/
35
+ _ = #/#/\/\#\\/#
36
+ _ = ##/#|\|\#\\/# #
37
+ }
38
+
39
+
You can’t perform that action at this time.
0 commit comments