9
9
//--- main.swift
10
10
11
11
import Swift
12
- // expected-note 6 {{add import of module 'lib'}}
12
+ // expected-note 15 {{add import of module 'lib'}}
13
13
14
14
for _ in makeSequence ( ) { }
15
15
// expected-error@-1 {{instance method 'makeIterator()' is not available due to missing import of defining module 'lib'}}
16
16
// expected-error@-2 {{instance method 'next()' is not available due to missing import of defining module 'lib'}}
17
17
18
+ takesNilExpressible ( nil )
19
+ // expected-error@-1 {{initializer 'init(nilLiteral:)' is not available due to missing import of defining module 'lib'}}
20
+
21
+ takesIntExpressible ( 1 )
22
+ // expected-error@-1 {{initializer 'init(integerLiteral:)' is not available due to missing import of defining module 'lib'}}
23
+
24
+ takesFloatExpressible ( 1.0 )
25
+ // expected-error@-1 {{initializer 'init(floatLiteral:)' is not available due to missing import of defining module 'lib'}}
26
+
27
+ takesBoolExpressible ( true )
28
+ // expected-error@-1 {{initializer 'init(booleanLiteral:)' is not available due to missing import of defining module 'lib'}}
29
+
30
+ takesUnicodeScalarExpressible ( " 🐦 " )
31
+ // expected-error@-1 {{initializer 'init(unicodeScalarLiteral:)' is not available due to missing import of defining module 'lib'}}
32
+
33
+ takesExtendedGraphemeClusterExpressible ( " 🦸🏾♀️ " )
34
+ // expected-error@-1 {{initializer 'init(extendedGraphemeClusterLiteral:)' is not available due to missing import of defining module 'lib'}}
35
+
36
+ takesStringLiteralExpressible ( " Hello world " )
37
+ // expected-error@-1 {{initializer 'init(stringLiteral:)' is not available due to missing import of defining module 'lib'}}
38
+
39
+ takesArrayExpressible ( [ 1 ] )
40
+ // expected-error@-1 {{initializer 'init(arrayLiteral:)' is not available due to missing import of defining module 'lib'}}
41
+
42
+ takesDictionaryExpressible ( [ " one " : 1 ] )
43
+ // expected-error@-1 {{initializer 'init(dictionaryLiteral:)' is not available due to missing import of defining module 'lib'}}
44
+
18
45
takesMessage ( " \( 1 ) " )
19
46
// expected-error@-1 {{initializer 'init(stringInterpolation:)' is not available due to missing import of defining module 'lib'}}
20
47
// expected-error@-2 {{instance method 'appendInterpolation' is not available due to missing import of defining module 'lib'}}
21
48
// expected-error@-3 2 {{instance method 'appendLiteral' is not available due to missing import of defining module 'lib'}}
22
49
50
+ takesColorExpressible ( #colorLiteral( red: 0.0 , green: 0.0 , blue: 0.0 , alpha: 1 ) )
51
+ // FIXME: Missing diangostic
52
+
53
+ takesImageExpressible ( #imageLiteral( resourceName: " image.png " ) )
54
+ // FIXME: Missing diangostic
55
+
56
+ takesFileReferenceExpressible ( #fileLiteral( resourceName: " file.txt " ) )
57
+ // FIXME: Missing diangostic
58
+
23
59
//--- other.swift
24
60
25
61
import lib
@@ -28,7 +64,19 @@ func makeSequence() -> EmptySequence {
28
64
return MySequence ( )
29
65
}
30
66
67
+ func takesNilExpressible( _ x: NilExpressible ) { }
68
+ func takesIntExpressible( _ x: IntExpressible ) { }
69
+ func takesFloatExpressible( _ x: FloatExpressible ) { }
70
+ func takesBoolExpressible( _ x: BoolExpressible ) { }
71
+ func takesUnicodeScalarExpressible( _ x: UnicodeScalarExpressible ) { }
72
+ func takesExtendedGraphemeClusterExpressible( _ x: ExtendedGraphemeClusterExpressible ) { }
73
+ func takesStringLiteralExpressible( _ x: StringExpressible ) { }
74
+ func takesArrayExpressible< E> ( _ x: ArrayExpressible < E > ) { }
75
+ func takesDictionaryExpressible< K, V> ( _ x: DictionaryExpressible < K , V > ) { }
31
76
func takesMessage( _ x: Message ) { }
77
+ func takesColorExpressible( _ x: ColorExpressible ) { }
78
+ func takesImageExpressible( _ x: ImageExpressible ) { }
79
+ func takesFileReferenceExpressible( _ x: FileReferenceExpressible ) { }
32
80
33
81
//--- lib.swift
34
82
@@ -41,6 +89,42 @@ public struct EmptySequence: Sequence {
41
89
public init ( ) { }
42
90
}
43
91
92
+ public struct NilExpressible : ExpressibleByNilLiteral {
93
+ public init ( nilLiteral: ( ) ) { }
94
+ }
95
+
96
+ public struct IntExpressible : ExpressibleByIntegerLiteral {
97
+ public init ( integerLiteral value: Int ) { }
98
+ }
99
+
100
+ public struct FloatExpressible : ExpressibleByFloatLiteral {
101
+ public init ( floatLiteral value: Float ) { }
102
+ }
103
+
104
+ public struct BoolExpressible : ExpressibleByBooleanLiteral {
105
+ public init ( booleanLiteral value: Bool ) { }
106
+ }
107
+
108
+ public struct UnicodeScalarExpressible : ExpressibleByUnicodeScalarLiteral {
109
+ public init ( unicodeScalarLiteral value: Unicode . Scalar ) { }
110
+ }
111
+
112
+ public struct ExtendedGraphemeClusterExpressible : ExpressibleByExtendedGraphemeClusterLiteral {
113
+ public init ( extendedGraphemeClusterLiteral value: Character ) { }
114
+ }
115
+
116
+ public struct StringExpressible : ExpressibleByStringLiteral {
117
+ public init ( stringLiteral value: String ) { }
118
+ }
119
+
120
+ public struct ArrayExpressible < Element> : ExpressibleByArrayLiteral {
121
+ public init ( arrayLiteral elements: Element ... ) { }
122
+ }
123
+
124
+ public struct DictionaryExpressible < Key, Value> : ExpressibleByDictionaryLiteral {
125
+ public init ( dictionaryLiteral elements: ( Key , Value ) ... ) { }
126
+ }
127
+
44
128
public struct MessageInterpolation : StringInterpolationProtocol {
45
129
public init ( literalCapacity: Int , interpolationCount: Int ) { }
46
130
public mutating func appendInterpolation( _ value: @autoclosure ( ) -> Int ) { }
@@ -51,3 +135,15 @@ public struct Message: ExpressibleByStringInterpolation {
51
135
public init ( stringInterpolation: MessageInterpolation ) { }
52
136
public init ( stringLiteral: String ) { }
53
137
}
138
+
139
+ public struct ColorExpressible : _ExpressibleByColorLiteral {
140
+ public init ( _colorLiteralRed red: Float , green: Float , blue: Float , alpha: Float ) { }
141
+ }
142
+
143
+ public struct ImageExpressible : _ExpressibleByImageLiteral {
144
+ public init ( imageLiteralResourceName path: String ) { }
145
+ }
146
+
147
+ public struct FileReferenceExpressible : _ExpressibleByFileReferenceLiteral {
148
+ public init ( fileReferenceLiteralResourceName path: String ) { }
149
+ }
0 commit comments