Skip to content

Commit f4a9e8d

Browse files
committed
[SourceKit] Update variable type request tests with qualified types
1 parent dda53f5 commit f4a9e8d

File tree

9 files changed

+39
-36
lines changed

9 files changed

+39
-36
lines changed

test/SourceKit/VariableType/basic.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ func foo() {
2222
let `else` = 3
2323

2424
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
25-
// CHECK: (1:5, 1:6): Int (explicit type: 1)
26-
// CHECK: (2:5, 2:6): String (explicit type: 0)
27-
// CHECK: (4:5, 4:8): [String] (explicit type: 0)
28-
// CHECK: (7:7, 7:8): String (explicit type: 1)
29-
// CHECK: (8:7, 8:8): String (explicit type: 0)
30-
// CHECK: (12:7, 12:8): Double (explicit type: 0)
31-
// CHECK: (13:7, 13:8): [A] (explicit type: 0)
32-
// CHECK: (14:7, 14:8): [Int : Int] (explicit type: 1)
33-
// CHECK: (15:7, 15:8): (Int) -> Int (explicit type: 1)
34-
// CHECK: (19:7, 19:12): Int (explicit type: 0)
35-
// CHECK: (22:5, 22:11): Int (explicit type: 0)
25+
// CHECK: (1:5, 1:6): Int, qualified: Swift.Int (explicit type: 1)
26+
// CHECK: (2:5, 2:6): String, qualified: Swift.String (explicit type: 0)
27+
// CHECK: (4:5, 4:8): [String], qualified: [Swift.String] (explicit type: 0)
28+
// CHECK: (7:7, 7:8): String, qualified: Swift.String (explicit type: 1)
29+
// CHECK: (8:7, 8:8): String, qualified: Swift.String (explicit type: 0)
30+
// CHECK: (12:7, 12:8): Double, qualified: Swift.Double (explicit type: 0)
31+
// CHECK: (13:7, 13:8): [A], qualified: [basic.A] (explicit type: 0)
32+
// CHECK: (14:7, 14:8): [Int : Int], qualified: [Swift.Int : Swift.Int] (explicit type: 1)
33+
// CHECK: (15:7, 15:8): (Int) -> Int, qualified: (Swift.Int) -> Swift.Int (explicit type: 1)
34+
// CHECK: (19:7, 19:12): Int, qualified: Swift.Int (explicit type: 0)
35+
// CHECK: (22:5, 22:11): Int, qualified: Swift.Int (explicit type: 0)

test/SourceKit/VariableType/case.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ case .pair(let u, var v):
1313
}
1414

1515
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
16-
// CHECK: (1:13, 1:14): Int (explicit type: 0)
17-
// CHECK: (2:13, 2:14): Int? (explicit type: 1)
18-
// CHECK: (3:16, 3:17): String? (explicit type: 1)
19-
// CHECK: (4:16, 4:17): String? (explicit type: 1)
20-
// CHECK: (11:16, 11:17): Int? (explicit type: 0)
21-
// CHECK: (11:23, 11:24): String (explicit type: 0)
16+
// CHECK: (1:13, 1:14): Int, qualified: Swift.Int (explicit type: 0)
17+
// CHECK: (2:13, 2:14): Int?, qualified: Swift.Int? (explicit type: 1)
18+
// CHECK: (3:16, 3:17): String?, qualified: Swift.String? (explicit type: 1)
19+
// CHECK: (4:16, 4:17): String?, qualified: Swift.String? (explicit type: 1)
20+
// CHECK: (11:16, 11:17): Int?, qualified: Swift.Int? (explicit type: 0)
21+
// CHECK: (11:23, 11:24): String, qualified: Swift.String (explicit type: 0)

test/SourceKit/VariableType/error.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ let y = "not an error type"
33

44
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
55
// CHECK-NOT: (1:5, 1:6)
6-
// CHECK: (2:5, 2:6): String (explicit type: 0)
6+
// CHECK: (2:5, 2:6): String, qualified: Swift.String (explicit type: 0)

test/SourceKit/VariableType/if-let.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ func foo() {
1010
}
1111

1212
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
13-
// CHECK: (1:11, 1:14): Int (explicit type: 1)
14-
// CHECK: (4:13, 4:14): String (explicit type: 0)
15-
// CHECK: (5:13, 5:14): String (explicit type: 1)
16-
// CHECK: (7:10, 7:11): Int (explicit type: 1)
17-
// CHECK: (9:13, 9:14): Int (explicit type: 1)
13+
// CHECK: (1:11, 1:14): Int, qualified: Swift.Int (explicit type: 1)
14+
// CHECK: (4:13, 4:14): String, qualified: Swift.String (explicit type: 0)
15+
// CHECK: (5:13, 5:14): String, qualified: Swift.String (explicit type: 1)
16+
// CHECK: (7:10, 7:11): Int, qualified: Swift.Int (explicit type: 1)
17+
// CHECK: (9:13, 9:14): Int, qualified: Swift.Int (explicit type: 1)

test/SourceKit/VariableType/inout.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ func x(_ param: inout Int) -> Int {
55
let z = { (param: inout String) in }
66

77
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
8-
// CHECK: (1:10, 1:15): Int (explicit type: 1)
9-
// CHECK: (5:5, 5:6): (inout String) -> () (explicit type: 0)
10-
// CHECK: (5:12, 5:17): String (explicit type: 1)
8+
// CHECK: (1:10, 1:15): Int, qualified: Swift.Int (explicit type: 1)
9+
// CHECK: (5:5, 5:6): (inout String) -> (), qualified: (inout Swift.String) -> () (explicit type: 0)
10+
// CHECK: (5:12, 5:17): String, qualified: Swift.String (explicit type: 1)

test/SourceKit/VariableType/params.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ let z = { (param: String) in
1111
let w: (String, Int) -> Void = { (_, x) in }
1212

1313
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
14-
// CHECK: (1:10, 1:15): Int (explicit type: 1)
15-
// CHECK: (5:5, 5:6): (String) -> Void (explicit type: 1)
16-
// CHECK: (5:29, 5:34): String (explicit type: 0)
17-
// CHECK: (7:5, 7:6): (String) -> Int (explicit type: 0)
18-
// CHECK: (7:12, 7:17): String (explicit type: 1)
19-
// CHECK: (11:35, 11:36): String (explicit type: 0)
20-
// CHECK: (11:38, 11:39): Int (explicit type: 0)
14+
// CHECK: (1:10, 1:15): Int, qualified: Swift.Int (explicit type: 1)
15+
// CHECK: (5:5, 5:6): (String) -> Void, qualified: (Swift.String) -> Swift.Void (explicit type: 1)
16+
// CHECK: (5:29, 5:34): String, qualified: Swift.String (explicit type: 0)
17+
// CHECK: (7:5, 7:6): (String) -> Int, qualified: (Swift.String) -> Swift.Int (explicit type: 0)
18+
// CHECK: (7:12, 7:17): String, qualified: Swift.String (explicit type: 1)
19+
// CHECK: (11:35, 11:36): String, qualified: Swift.String (explicit type: 0)
20+
// CHECK: (11:38, 11:39): Int, qualified: Swift.Int (explicit type: 0)

test/SourceKit/VariableType/ranged.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ var w = 4
55

66
// RUN: %sourcekitd-test -req=collect-var-type -pos=2:1 -end-pos=4:1 %s -- %s | %FileCheck %s
77
// CHECK-NOT: (1:5, 1:6)
8-
// CHECK: (2:5, 2:6): String (explicit type: 0)
9-
// CHECK: (3:5, 3:6): String (explicit type: 1)
8+
// CHECK: (2:5, 2:6): String, qualified: Swift.String (explicit type: 0)
9+
// CHECK: (3:5, 3:6): String, qualified: Swift.String (explicit type: 1)
1010
// CHECK-NOT: (4:5, 4:6)

test/SourceKit/VariableType/unnamed.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ let x: (String) -> Void = { (: String) in }
55

66
// RUN: %sourcekitd-test -req=collect-var-type %s -- %s | %FileCheck %s
77
// CHECK: <VariableTypes>
8-
// CHECK-NEXT: (4:5, 4:6): (String) -> Void (explicit type: 1)
8+
// CHECK-NEXT: (4:5, 4:6): (String) -> Void, qualified: (Swift.String) -> Swift.Void (explicit type: 1)
99
// CHECK-NEXT: </VariableTypes>
1010

tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,12 +2091,15 @@ static void printVariableType(sourcekitd_variant_t Info,
20912091
auto End = resolveToLineCol(Offset + Length, SourceBuf);
20922092
bool HasExplicitType = sourcekitd_variant_dictionary_get_bool(Item, KeyVariableTypeExplicit);
20932093
auto PrintedType = sourcekitd_variant_dictionary_get_string(Item, KeyVariableType);
2094+
auto PrintedQualifiedType = sourcekitd_variant_dictionary_get_string(Item, KeyVariableQualifiedType);
20942095
OS << "("
20952096
<< Start.first << ":" << Start.second
20962097
<< ", "
20972098
<< End.first << ":" << End.second
20982099
<< "): "
20992100
<< PrintedType
2101+
<< ", qualified: "
2102+
<< PrintedQualifiedType
21002103
<< " (explicit type: " << HasExplicitType << ")\n";
21012104
}
21022105
OS << "</VariableTypes>\n";

0 commit comments

Comments
 (0)