File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
test/Serialization/Recovery Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -713,8 +713,15 @@ void ModuleFile::loadObjCMethods(
713713 continue ;
714714
715715 // Deserialize the method and add it to the list.
716+ // Drop methods with errors.
717+ auto funcOrError = getDeclChecked (std::get<2 >(result));
718+ if (!funcOrError) {
719+ diagnoseAndConsumeError (funcOrError.takeError ());
720+ continue ;
721+ }
722+
716723 if (auto func = dyn_cast_or_null<AbstractFunctionDecl>(
717- getDecl (std:: get< 2 >(result) ))) {
724+ funcOrError. get ( ))) {
718725 methods.push_back (func);
719726 }
720727 }
Original file line number Diff line number Diff line change 1+ /// Recover under diagnoseUnintendedObjCMethodOverrides.
2+ /// rdar://138764733
3+
4+ // RUN: %empty-directory(%t)
5+ // RUN: split-file %s %t
6+ // REQUIRES: objc_interop
7+
8+ // RUN: %target-swift-frontend -emit-module %t/HiddenDep.swift -I %t \
9+ // RUN: -o %t/HiddenDep.swiftmodule \
10+ // RUN: -disable-objc-attr-requires-foundation-module
11+
12+ // RUN: %target-swift-frontend -emit-module %t/Lib.swift -I %t \
13+ // RUN: -o %t/Lib.swiftmodule \
14+ // RUN: -swift-version 6 -enable-library-evolution \
15+ // RUN: -disable-objc-attr-requires-foundation-module
16+
17+ // RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
18+ // RUN: -disable-objc-attr-requires-foundation-module
19+
20+ //--- HiddenDep.swift
21+ @objc
22+ public class HiddenType { }
23+
24+ //--- Lib.swift
25+ internal import HiddenDep
26+
27+ @objc public class Redecl {
28+ @objc
29+ func methodWithXref( ) -> HiddenType { fatalError ( ) }
30+ }
31+
32+ //--- Client.swift
33+ import Lib
34+
35+ extension Redecl {
36+ @objc ( methodWithXref)
37+ func methodWithXref_alias( ) { }
38+ }
You can’t perform that action at this time.
0 commit comments