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 {
2959
2959
explicit StmtAvailabilityWalker (ExportContext where)
2960
2960
: Where(where) {}
2961
2961
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
+
2962
2970
// / We'll visit the expression from performSyntacticExprDiagnostics().
2963
2971
std::pair<bool , Expr *> walkToExprPre (Expr *E) override {
2964
2972
return std::make_pair (false , E);
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ func internalFunction() {}
18
18
public func publicFunction( ) { }
19
19
20
20
private 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}}
23
23
struct InternalStruct { }
24
24
// expected-note@-1 3{{struct 'InternalStruct' is not '@usableFromInline' or public}}
25
25
// expected-note@-2 {{initializer 'init()' is not '@usableFromInline' or public}}
@@ -350,3 +350,10 @@ public struct PrivateInlinableCrash {
350
350
// expected-error@-1 {{'@inlinable' attribute cannot be applied to stored properties}}
351
351
}
352
352
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