File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -2959,6 +2959,14 @@ class StmtAvailabilityWalker : public ASTWalker {
29592959 explicit StmtAvailabilityWalker (ExportContext where)
29602960 : Where(where) {}
29612961
2962+ // / We'll visit each element of a BraceStmt individually.
2963+ std::pair<bool , Stmt *> walkToStmtPre (Stmt *S) override {
2964+ if (isa<BraceStmt>(S))
2965+ return std::make_pair (false , S);
2966+
2967+ return std::make_pair (true , S);
2968+ }
2969+
29622970 // / We'll visit the expression from performSyntacticExprDiagnostics().
29632971 std::pair<bool , Expr *> walkToExprPre (Expr *E) override {
29642972 return std::make_pair (false , E);
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ func internalFunction() {}
1818public func publicFunction( ) { }
1919
2020private struct PrivateStruct { }
21- // expected-note@-1 3 {{struct 'PrivateStruct' is not '@usableFromInline' or public}}
22- // expected-note@-2 {{initializer 'init()' is not '@usableFromInline' or public}}
21+ // expected-note@-1 5 {{struct 'PrivateStruct' is not '@usableFromInline' or public}}
22+ // expected-note@-2 2 {{initializer 'init()' is not '@usableFromInline' or public}}
2323struct InternalStruct { }
2424// expected-note@-1 3{{struct 'InternalStruct' is not '@usableFromInline' or public}}
2525// expected-note@-2 {{initializer 'init()' is not '@usableFromInline' or public}}
@@ -350,3 +350,10 @@ public struct PrivateInlinableCrash {
350350 // expected-error@-1 {{'@inlinable' attribute cannot be applied to stored properties}}
351351}
352352
353+ @inlinable public func nestedBraceStmtTest( ) {
354+ if true {
355+ let _: PrivateStruct = PrivateStruct ( )
356+ // expected-error@-1 2{{struct 'PrivateStruct' is private and cannot be referenced from an '@inlinable' function}}
357+ // expected-error@-2 {{initializer 'init()' is private and cannot be referenced from an '@inlinable' function}}
358+ }
359+ }
You can’t perform that action at this time.
0 commit comments