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