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> {
4031
4031
// / \returns the number of entries added.
4032
4032
size_t addInherited (InheritedTypes inheritedEntries,
4033
4033
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);
4035
4044
assert (!inherited.getType () || !inherited.getType ()->hasArchetype ());
4036
4045
TypeID typeRef = S.addTypeRef (inherited.getType ());
4037
4046
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
27
27
extension SomeEnum : undefined { } // expected-error {{cannot find type 'undefined'}}
28
28
29
29
extension 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'}}
31
31
extension undefined : SomeProto { } // expected-error {{cannot find type 'undefined'}}
32
32
33
33
public extension undefined { // expected-error {{cannot find type 'undefined' in scope}}
34
34
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}}
37
37
enum SomeEnumInner : undefined { // expected-error {{cannot find type 'undefined' in scope}}
38
38
case a
39
39
}
You can’t perform that action at this time.
0 commit comments