File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -4685,6 +4685,9 @@ class EditorPlaceholderExpr : public Expr {
4685
4685
SourceRange getSourceRange () const { return Loc; }
4686
4686
TypeLoc &getTypeLoc () { return PlaceholderTy; }
4687
4687
TypeLoc getTypeLoc () const { return PlaceholderTy; }
4688
+ SourceLoc getTrailingAngleBracketLoc () const {
4689
+ return Loc.getAdvancedLoc (Placeholder.getLength () - 1 );
4690
+ }
4688
4691
4689
4692
// / The TypeRepr to be considered for placeholder expansion.
4690
4693
TypeRepr *getTypeForExpansion () const { return ExpansionTyR; }
Original file line number Diff line number Diff line change @@ -2635,7 +2635,19 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2635
2635
PrintWithColorRAII (OS, ParenthesisColor) << ' )' ;
2636
2636
}
2637
2637
void visitEditorPlaceholderExpr (EditorPlaceholderExpr *E) {
2638
- printCommon (E, " editor_placeholder_expr" ) << ' \n ' ;
2638
+ printCommon (E, " editor_placeholder_expr" ) << ' ' ;
2639
+
2640
+ // Print the trailing angle bracket location
2641
+ if (auto Ty = GetTypeOfExpr (E)) {
2642
+ auto &Ctx = Ty->getASTContext ();
2643
+ auto TABL = E->getTrailingAngleBracketLoc ();
2644
+ if (TABL.isValid ()) {
2645
+ PrintWithColorRAII (OS, LocationColor) << " trailing_angle_bracket_loc=" ;
2646
+ TABL.print (PrintWithColorRAII (OS, LocationColor).getOS (),
2647
+ Ctx.SourceMgr );
2648
+ }
2649
+ }
2650
+ OS << ' \n ' ;
2639
2651
auto *TyR = E->getTypeLoc ().getTypeRepr ();
2640
2652
auto *ExpTyR = E->getTypeForExpansion ();
2641
2653
if (TyR)
Original file line number Diff line number Diff line change 2
2
3
3
func string_interpolation( ) {
4
4
" \( " abc " ) "
5
+ < #Int#>
5
6
}
6
7
7
- // RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s
8
+ // RUN: not %target-swift-frontend -dump-ast %s | %FileCheck %s
8
9
// CHECK: (interpolated_string_literal_expr {{.*}} trailing_quote_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:4:12 {{.*}}
10
+ // CHECK: (editor_placeholder_expr type='()' {{.*}} trailing_angle_bracket_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:5:9
11
+
You can’t perform that action at this time.
0 commit comments