Skip to content

Commit baabaa0

Browse files
committed
NCGenerics: add workaround for rev. condfail
resolves rdar://130424971
1 parent 465634c commit baabaa0

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@ GenericSignatureRequest::evaluate(Evaluator &evaluator,
788788
// to invertible protocols. This forces people to write out the conditions.
789789
inferInvertibleReqs = !ext->isAddingConformanceToInvertible();
790790

791+
// FIXME: to workaround a reverse condfail, always infer the requirements if
792+
// the extension is in a swiftinterface file. This is temporary and should
793+
// be removed soon. (rdar://130424971)
794+
if (auto *sf = ext->getOutermostParentSourceFile()) {
795+
if (sf->Kind == SourceFileKind::Interface)
796+
inferInvertibleReqs = true;
797+
}
798+
791799
collectAdditionalExtensionRequirements(ext->getExtendedType(), extraReqs);
792800

793801
auto *extendedNominal = ext->getExtendedNominal();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/bug.swiftinterface) -I %t
4+
5+
//--- bug.swiftinterface
6+
7+
// swift-interface-format-version: 1.0
8+
// swift-compiler-version: Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3)
9+
// swift-module-flags: -target arm64-apple-macosx15.0 -enable-objc-interop -enable-library-evolution -module-name bug
10+
import Swift
11+
import _Concurrency
12+
import _StringProcessing
13+
import _SwiftConcurrencyShims
14+
#if compiler(>=5.3) && $NoncopyableGenerics
15+
public enum Maybe<Wrapped> : ~Swift.Copyable where Wrapped : ~Copyable {
16+
case just(Wrapped)
17+
case none
18+
}
19+
#else
20+
public enum Maybe<Wrapped> {
21+
case just(Wrapped)
22+
case none
23+
}
24+
#endif
25+
#if compiler(>=5.3) && $NoncopyableGenerics
26+
extension bug.Maybe : Swift.Copyable {
27+
}
28+
#else
29+
extension bug.Maybe {
30+
}
31+
#endif
32+

0 commit comments

Comments
 (0)