File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ final class InlayHintsTests: XCTestCase {
67
67
let x = 4
68
68
var y = " test " + " 123 "
69
69
"""
70
+ // FIXME: These type hints should ideally be displayed after the variable name
71
+ // rather than after the expression. Once the implementation is updated (e.g.
72
+ // by using a new SourceKit request), these tests should be updated too.
70
73
let hints = performInlayHintsRequest ( text: text)
71
74
XCTAssertEqual ( hints, [
72
75
InlayHint (
@@ -156,4 +159,30 @@ final class InlayHintsTests: XCTestCase {
156
159
) ,
157
160
] )
158
161
}
162
+
163
+ func testExplicitTypeAnnotation( ) {
164
+ let text = """
165
+ let x: String = " abc "
166
+
167
+ struct X {
168
+ var y: Int = 34
169
+ }
170
+ """
171
+ let hints = performInlayHintsRequest ( text: text)
172
+ // FIXME: Explicitly type-annotated variable bindings shouldn't have
173
+ // an inlay hint. Once we move to the new SourceKit request (as detailed
174
+ // in the other comment above), we should receive the empty array here.
175
+ XCTAssertEqual ( hints, [
176
+ InlayHint (
177
+ position: Position ( line: 0 , utf16index: 21 ) ,
178
+ category: . type,
179
+ label: " String "
180
+ ) ,
181
+ InlayHint (
182
+ position: Position ( line: 3 , utf16index: 17 ) ,
183
+ category: . type,
184
+ label: " Int "
185
+ )
186
+ ] )
187
+ }
159
188
}
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ extension InlayHintsTests {
96
96
static let __allTests__InlayHintsTests = [
97
97
( " testBindings " , testBindings) ,
98
98
( " testEmpty " , testEmpty) ,
99
+ ( " testExplicitTypeAnnotation " , testExplicitTypeAnnotation) ,
99
100
( " testFields " , testFields) ,
100
101
( " testRanged " , testRanged) ,
101
102
]
You can’t perform that action at this time.
0 commit comments