File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,11 @@ void TBDGenVisitor::visitVarDecl(VarDecl *VD) {
848
848
visitAbstractStorageDecl (VD);
849
849
}
850
850
851
+ void TBDGenVisitor::visitSubscriptDecl (SubscriptDecl *SD) {
852
+ visitDefaultArguments (SD, SD->getIndices ());
853
+ visitAbstractStorageDecl (SD);
854
+ }
855
+
851
856
void TBDGenVisitor::visitNominalTypeDecl (NominalTypeDecl *NTD) {
852
857
auto declaredType = NTD->getDeclaredType ()->getCanonicalType ();
853
858
Original file line number Diff line number Diff line change @@ -214,6 +214,8 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
214
214
215
215
void visitVarDecl (VarDecl *VD);
216
216
217
+ void visitSubscriptDecl (SubscriptDecl *SD);
218
+
217
219
void visitEnumDecl (EnumDecl *ED);
218
220
219
221
void visitEnumElementDecl (EnumElementDecl *EED);
Original file line number Diff line number Diff line change
1
+ // REQUIRES: VENDOR=apple
2
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s
3
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -enable-testing
4
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -O
5
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -enable-testing -O
6
+
7
+ // RUN: %empty-directory(%t)
8
+ // RUN: %target-swift-frontend -typecheck -parse-as-library -module-name test %s -emit-tbd -emit-tbd-path %t/typecheck.tbd
9
+ // RUN: %target-swift-frontend -emit-ir -parse-as-library -module-name test %s -emit-tbd -emit-tbd-path %t/emit-ir.tbd
10
+ // RUN: diff -u %t/typecheck.tbd %t/emit-ir.tbd
11
+
12
+ public protocol DefaultInit {
13
+ init ( )
14
+ }
15
+
16
+ @available ( macOS 10 . 15 , * )
17
+ struct X {
18
+ subscript< T: DefaultInit > ( _ value: Int = 0 , other: T = T ( ) ) -> Int { value + 1 }
19
+
20
+ static subscript< T> ( _ value: String = " hello " , other: T ) -> String {
21
+ get { value }
22
+ set { }
23
+ }
24
+ }
25
+
You can’t perform that action at this time.
0 commit comments