99//--- main.swift
1010
1111import Swift
12- // expected-note 6 {{add import of module 'lib'}}
12+ // expected-note 15 {{add import of module 'lib'}}
1313
1414for _ in makeSequence ( ) { }
1515// expected-error@-1 {{instance method 'makeIterator()' is not available due to missing import of defining module 'lib'}}
1616// expected-error@-2 {{instance method 'next()' is not available due to missing import of defining module 'lib'}}
1717
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+
1845takesMessage ( " \( 1 ) " )
1946// expected-error@-1 {{initializer 'init(stringInterpolation:)' is not available due to missing import of defining module 'lib'}}
2047// expected-error@-2 {{instance method 'appendInterpolation' is not available due to missing import of defining module 'lib'}}
2148// expected-error@-3 2 {{instance method 'appendLiteral' is not available due to missing import of defining module 'lib'}}
2249
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+
2359//--- other.swift
2460
2561import lib
@@ -28,7 +64,19 @@ func makeSequence() -> EmptySequence {
2864 return MySequence ( )
2965}
3066
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 > ) { }
3176func takesMessage( _ x: Message ) { }
77+ func takesColorExpressible( _ x: ColorExpressible ) { }
78+ func takesImageExpressible( _ x: ImageExpressible ) { }
79+ func takesFileReferenceExpressible( _ x: FileReferenceExpressible ) { }
3280
3381//--- lib.swift
3482
@@ -41,6 +89,42 @@ public struct EmptySequence: Sequence {
4189 public init ( ) { }
4290}
4391
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+
44128public struct MessageInterpolation : StringInterpolationProtocol {
45129 public init ( literalCapacity: Int , interpolationCount: Int ) { }
46130 public mutating func appendInterpolation( _ value: @autoclosure ( ) -> Int ) { }
@@ -51,3 +135,15 @@ public struct Message: ExpressibleByStringInterpolation {
51135 public init ( stringInterpolation: MessageInterpolation ) { }
52136 public init ( stringLiteral: String ) { }
53137}
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