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 @@ -9095,6 +9095,20 @@ Type ConstructorDecl::getInitializerInterfaceType() {
9095
9095
}
9096
9096
9097
9097
CtorInitializerKind ConstructorDecl::getInitKind () const {
9098
+ const auto *ED =
9099
+ dyn_cast_or_null<ExtensionDecl>(getDeclContext ()->getAsDecl ());
9100
+ if (ED && !ED->hasBeenBound ()) {
9101
+ // When the declaration context is an extension and this is called when the
9102
+ // extended nominal hasn't be bound yet, e.g. dumping pre-typechecked AST,
9103
+ // there is not enough information about extended nominal to use for
9104
+ // computing init kind on InitKindRequest as bindExtensions is done at
9105
+ // typechecking, so in that case just look to parsed attribute in init
9106
+ // declaration.
9107
+ return getAttrs ().hasAttribute <ConvenienceAttr>()
9108
+ ? CtorInitializerKind::Convenience
9109
+ : CtorInitializerKind::Designated;
9110
+ }
9111
+
9098
9112
return evaluateOrDefault (getASTContext ().evaluator ,
9099
9113
InitKindRequest{const_cast <ConstructorDecl *>(this )},
9100
9114
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