File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
Serialization/AllowErrors Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -4031,7 +4031,16 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
40314031 // / \returns the number of entries added.
40324032 size_t addInherited (InheritedTypes inheritedEntries,
40334033 SmallVectorImpl<TypeID> &result) {
4034- for (const auto &inherited : inheritedEntries.getEntries ()) {
4034+ for (size_t i : inheritedEntries.getIndices ()) {
4035+ // Ensure that we run the `InheritedTypeRequest` before getting the
4036+ // inherited type. We serialize the inherited type from `getEntry` rather
4037+ // than `getResolvedType` since the former represents a suppressed
4038+ // conformance as a separate bit distinct from the type, which is how we
4039+ // want to serialize it. We thus need to get the type to serialize using a
4040+ // subsequent call to `getEntry(i).getType()` (see
4041+ // `InheritedTypeRequest::cacheResult`).
4042+ (void )inheritedEntries.getResolvedType (i);
4043+ const InheritedEntry &inherited = inheritedEntries.getEntry (i);
40354044 assert (!inherited.getType () || !inherited.getType ()->hasArchetype ());
40364045 TypeID typeRef = S.addTypeRef (inherited.getType ());
40374046
Original file line number Diff line number Diff line change 1+ public protocol MyProto { }
2+ public struct MyStruct : MyProto { }
3+
4+ // RUN: %empty-directory(%t)
5+ // RUN: %swift -emit-module -o %t/swift_mod.swiftmodule %s -parse-as-library -experimental-skip-all-function-bodies -experimental-skip-non-exportable-decls -experimental-lazy-typecheck -target %target-triple
6+ // RUN: %target-swift-synthesize-interface -module-name swift_mod -I %t -o - -target %target-triple | %FileCheck %s
7+
8+ // CHECK: public struct MyStruct : swift_mod.MyProto
Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ extension SomeStruct: undefined {} // expected-error {{cannot find type 'undefin
2727extension SomeEnum : undefined { } // expected-error {{cannot find type 'undefined'}}
2828
2929extension undefined { } // expected-error {{cannot find type 'undefined'}}
30- extension undefined : undefined { } // expected-error {{cannot find type 'undefined'}}
30+ extension undefined : undefined { } // expected-error 2 {{cannot find type 'undefined'}}
3131extension undefined : SomeProto { } // expected-error {{cannot find type 'undefined'}}
3232
3333public extension undefined { // expected-error {{cannot find type 'undefined' in scope}}
3434 protocol SomeProtoInner : undefined { } // expected-error {{cannot find type 'undefined' in scope}}
35- class SomeClassInner : undefined { }
36- struct SomeStructInner : undefined { }
35+ class SomeClassInner : undefined { } // expected-error {{cannot find type 'undefined' in scope}}
36+ struct SomeStructInner : undefined { } // expected-error {{cannot find type 'undefined' in scope}}
3737 enum SomeEnumInner : undefined { // expected-error {{cannot find type 'undefined' in scope}}
3838 case a
3939 }
You can’t perform that action at this time.
0 commit comments