Skip to content

Commit cde03e6

Browse files
authored
Merge pull request #33072 from rintaro/ide-index-test-explicitcast
[Test] Add indexing test cases for ExplicitCastExpr
2 parents 5e7bafc + f2502b9 commit cde03e6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/Index/expressions.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-swift-ide-test -print-indexed-symbols -source-filename %s | %FileCheck %s
22

3+
// CHECK: [[@LINE+1]]:10 | protocol/Swift | P1 | [[P1_USR:.*]] | Def
34
protocol P1 {}
45

56
// CHECK: [[@LINE+1]]:8 | struct/Swift | S1 | [[S1_USR:.*]] | Def
@@ -76,3 +77,13 @@ func useDisposable(_ d: Disposable?) {
7677
guard let dispose = d?.dispose else { return }
7778
_ = dispose
7879
}
80+
81+
func castExpr(x: Any) {
82+
// CHECK: [[@LINE+2]]:9 | struct/Swift | S1 | [[S1_USR]] | Ref
83+
// CHECK: [[@LINE+1]]:17 | protocol/Swift | P1 | [[P1_USR]] | Ref
84+
_ = S1() as P1
85+
// CHECK: [[@LINE+1]]:15 | struct/Swift | S1 | [[S1_USR]] | Ref
86+
_ = x as! S1
87+
// CHECK: [[@LINE+1]]:15 | struct/Swift | S1 | [[S1_USR]] | Ref
88+
_ = x as? S1
89+
}

0 commit comments

Comments
 (0)