Skip to content

Commit 587cec0

Browse files
committed
---
yaml --- r: 349364 b: refs/heads/master-next c: 4e4836d h: refs/heads/master
1 parent 1d90297 commit 587cec0

File tree

7 files changed

+49
-4
lines changed

7 files changed

+49
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: cc3959f3d8b202e2f0c8fcf49faf003a76950822
3+
refs/heads/master-next: 4e4836d708dc55bc1b7926a5983977890d88af7a
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 507; // exact_self_class sil attr
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 508; // generic opaque return type xref
5656

5757
using DeclIDField = BCFixed<31>;
5858

branches/master-next/lib/Serialization/Deserialization.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,8 @@ ModuleFile::resolveCrossReference(ModuleID MID, uint32_t pathLen) {
17191719
currentSig = fn->getGenericSignature();
17201720
} else if (auto subscript = dyn_cast<SubscriptDecl>(base)) {
17211721
currentSig = subscript->getGenericSignature();
1722+
} else if (auto opaque = dyn_cast<OpaqueTypeDecl>(base)) {
1723+
currentSig = opaque->getGenericSignature();
17221724
}
17231725

17241726
if (!currentSig) {

branches/master-next/lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,8 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
17311731
case DeclContextKind::GenericTypeDecl: {
17321732
auto generic = cast<GenericTypeDecl>(DC);
17331733

1734+
writeCrossReference(DC->getParent(), pathLen + 1);
1735+
17341736
// Opaque return types are unnamed and need a special xref.
17351737
if (auto opaque = dyn_cast<OpaqueTypeDecl>(generic)) {
17361738
if (!opaque->hasName()) {
@@ -1744,8 +1746,6 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
17441746
}
17451747

17461748
assert(generic->hasName());
1747-
1748-
writeCrossReference(DC->getParent(), pathLen + 1);
17491749

17501750
abbrCode = DeclTypeAbbrCodes[XRefTypePathPieceLayout::Code];
17511751

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public protocol BestProtocol {}
2+
public protocol GoodProtocol {
3+
associatedtype A
4+
}
5+
6+
public struct BestStruct: BestProtocol {
7+
public init() {}
8+
}
9+
10+
extension BestProtocol {
11+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
12+
public func _bestValue<X: GoodProtocol>(_ x: X.Type, _ a: X.A) -> some BestProtocol {
13+
return BestStruct()
14+
}
15+
}
16+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"./best-protocol.swift": {
3+
"swiftmodule": "./best-protocol.swiftmodule"
4+
},
5+
"./xref-opaque-generic-type.swift": {
6+
"swiftmodule": "./xref-opaque-generic-type.swiftmodule"
7+
}
8+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp -r %S/Inputs/xref-opaque-generic-type/* %t/.
3+
// RUN: cp %s %t/xref-generic-opaque-type.swift
4+
// RUN: cd %t
5+
// RUN: %target-swiftc_driver -emit-module -incremental %t/best-protocol.swift %t/xref-generic-opaque-type.swift -module-name A -output-file-map %t/output.json
6+
7+
@usableFromInline
8+
struct GoodStruct: GoodProtocol {
9+
@usableFromInline
10+
typealias A = Int
11+
}
12+
13+
extension BestProtocol {
14+
@inlinable
15+
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
16+
public func bestValue(_ x: Int) -> some BestProtocol {
17+
return _bestValue(GoodStruct.self, x)
18+
}
19+
}

0 commit comments

Comments
 (0)