File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -1174,8 +1174,23 @@ namespace {
1174
1174
printCommonAFD (CD, " constructor_decl" );
1175
1175
if (CD->isRequired ())
1176
1176
PrintWithColorRAII (OS, DeclModifierColor) << " required" ;
1177
- PrintWithColorRAII (OS, DeclModifierColor) << " "
1178
- << getCtorInitializerKindString (CD->getInitKind ());
1177
+
1178
+ CtorInitializerKind kind;
1179
+ const auto *ED =
1180
+ dyn_cast_or_null<ExtensionDecl>(CD->getDeclContext ()->getAsDecl ());
1181
+ if (ED && !ED->hasBeenBound ()) {
1182
+ // When dumping pre-typechecked AST there is not enough information
1183
+ // about extended nominal to use for computing init kind as
1184
+ // bindExtensions is done at typechecking, so in that case just look to
1185
+ // parsed attribute in init declaration.
1186
+ kind = CD->getAttrs ().hasAttribute <ConvenienceAttr>()
1187
+ ? CtorInitializerKind::Convenience
1188
+ : CtorInitializerKind::Designated;
1189
+ } else {
1190
+ kind = CD->getInitKind ();
1191
+ }
1192
+ PrintWithColorRAII (OS, DeclModifierColor)
1193
+ << " " << getCtorInitializerKindString (kind);
1179
1194
if (CD->isFailable ())
1180
1195
PrintWithColorRAII (OS, DeclModifierColor) << " failable="
1181
1196
<< (CD->isImplicitlyUnwrappedOptional ()
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