File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1212
1313#include " swift/AST/LifetimeDependence.h"
1414#include " swift/AST/ASTContext.h"
15+ #include " swift/AST/ASTPrinter.h"
1516#include " swift/AST/Builtins.h"
1617#include " swift/AST/ConformanceLookup.h"
1718#include " swift/AST/Decl.h"
@@ -30,8 +31,14 @@ namespace swift {
3031
3132std::string LifetimeDescriptor::getString () const {
3233 switch (kind) {
33- case DescriptorKind::Named:
34+ case DescriptorKind::Named: {
35+ bool shouldEscape =
36+ escapeIdentifierInContext (getName (), PrintNameContext::Normal);
37+ if (shouldEscape) {
38+ return (" `" + getName ().str () + " `" ).str ();
39+ }
3440 return getName ().str ().str ();
41+ }
3542 case DescriptorKind::Ordered:
3643 return std::to_string (getIndex ());
3744 case DescriptorKind::Self:
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ public func barFunc(_ bar: inout S) -> S {
2424@_lifetime ( `func`: copy `func`)
2525public func funcFunc( func: inout S ) { }
2626
27+ public struct T : ~ Escapable {
28+ let s : S
29+ @_lifetime ( borrow self)
30+ func selfFunc( ) -> S { return s }
31+ @_lifetime ( borrow `self`)
32+ func selfFunc2( `self`: S ) -> S { return `self` }
33+ }
34+
2735//--- interface.txt.expected
2836
2937public struct S : ~ Escapable {
@@ -35,5 +43,16 @@ public struct S : ~Escapable {
3543public func fooFunc( _ foo: inout S )
3644@_lifetime ( & bar)
3745public func barFunc( _ bar: inout S ) -> S
38- @_lifetime ( func: copy func )
46+ @_lifetime ( ` func` : copy ` func` )
3947public func func Func( func: inout S )
48+
49+ public struct T : ~ Escapable {
50+
51+ internal let s : S
52+
53+ @_lifetime ( borrow self)
54+ internal func selfFunc( ) -> S
55+
56+ @_lifetime ( borrow `self`)
57+ internal func selfFunc2( self: S ) -> S
58+ }
You can’t perform that action at this time.
0 commit comments