File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
test/SourceKit/ExpressionType Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -667,6 +667,10 @@ class ExpressionTypeCollector: public SourceEntityWalker {
667
667
if (E->getType ().isNull ())
668
668
return false ;
669
669
670
+ // We should not report a type for InjectIntoOptionalExpr
671
+ if (isa<InjectIntoOptionalExpr>(E))
672
+ return false ;
673
+
670
674
// If we have already reported types for this source range, we shouldn't
671
675
// report again. This makes sure we always report the outtermost type of
672
676
// several overlapping expressions.
Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ func DictS(_ a: [Int: S]) {
20
20
_ = a [ 2 ] ? . val. advanced ( by: 1 ) . byteSwapped
21
21
}
22
22
23
+ func optExpr( str: String ? ) -> String ? {
24
+ let a : String ? = str
25
+ let b : String ? = " Hey "
26
+ let c : String = " Bye "
27
+ return c
28
+ }
29
+
23
30
// RUN: %sourcekitd-test -req=collect-type %s -- %s | %FileCheck %s
24
31
// CHECK: (183, 202): Int
25
32
// CHECK: (183, 196): String
@@ -31,3 +38,6 @@ func DictS(_ a: [Int: S]) {
31
38
// CHECK: (291, 292): Int?
32
39
// CHECK: (295, 332): Int?
33
40
// CHECK: (295, 320): Int
41
+ // CHECK: (395, 398): String?
42
+ // CHECK: (418, 423): String
43
+ // CHECK: (457, 458): String
You can’t perform that action at this time.
0 commit comments