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 12
12
13
13
#include " swift/AST/LifetimeDependence.h"
14
14
#include " swift/AST/ASTContext.h"
15
+ #include " swift/AST/ASTPrinter.h"
15
16
#include " swift/AST/Builtins.h"
16
17
#include " swift/AST/ConformanceLookup.h"
17
18
#include " swift/AST/Decl.h"
@@ -30,8 +31,14 @@ namespace swift {
30
31
31
32
std::string LifetimeDescriptor::getString () const {
32
33
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
+ }
34
40
return getName ().str ().str ();
41
+ }
35
42
case DescriptorKind::Ordered:
36
43
return std::to_string (getIndex ());
37
44
case DescriptorKind::Self:
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ public func barFunc(_ bar: inout S) -> S {
24
24
@_lifetime ( `func`: copy `func`)
25
25
public func funcFunc( func: inout S ) { }
26
26
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
+
27
35
//--- interface.txt.expected
28
36
29
37
public struct S : ~ Escapable {
@@ -35,5 +43,16 @@ public struct S : ~Escapable {
35
43
public func fooFunc( _ foo: inout S )
36
44
@_lifetime ( & bar)
37
45
public func barFunc( _ bar: inout S ) -> S
38
- @_lifetime ( func: copy func )
46
+ @_lifetime ( ` func` : copy ` func` )
39
47
public 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