File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -9104,6 +9104,20 @@ Type ConstructorDecl::getInitializerInterfaceType() {
9104
9104
}
9105
9105
9106
9106
CtorInitializerKind ConstructorDecl::getInitKind () const {
9107
+ const auto *ED =
9108
+ dyn_cast_or_null<ExtensionDecl>(getDeclContext ()->getAsDecl ());
9109
+ if (ED && !ED->hasBeenBound ()) {
9110
+ // When the declaration context is an extension and this is called when the
9111
+ // extended nominal hasn't be bound yet, e.g. dumping pre-typechecked AST,
9112
+ // there is not enough information about extended nominal to use for
9113
+ // computing init kind on InitKindRequest as bindExtensions is done at
9114
+ // typechecking, so in that case just look to parsed attribute in init
9115
+ // declaration.
9116
+ return getAttrs ().hasAttribute <ConvenienceAttr>()
9117
+ ? CtorInitializerKind::Convenience
9118
+ : CtorInitializerKind::Designated;
9119
+ }
9120
+
9107
9121
return evaluateOrDefault (getASTContext ().evaluator ,
9108
9122
InitKindRequest{const_cast <ConstructorDecl *>(this )},
9109
9123
CtorInitializerKind::Designated);
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -dump-parse
2
+
3
+ // https://github.com/apple/swift/issues/61806
4
+
5
+ struct I61806 { }
6
+ extension I61806 {
7
+ init ( ) { }
8
+ }
9
+
10
+ class I61806_C {
11
+ init ( ) { }
12
+ }
13
+ extension I61806_C {
14
+ convenience init ( a: Int ) { }
15
+ }
16
+
17
+ protocol I61806_P { }
18
+ extension I61806_P {
19
+ init ( ) { }
20
+ }
You can’t perform that action at this time.
0 commit comments