File tree Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -831,9 +831,11 @@ std::string ASTMangler::mangleOpaqueTypeDecl(const OpaqueTypeDecl *decl) {
831
831
}
832
832
833
833
std::string ASTMangler::mangleOpaqueTypeDecl (const ValueDecl *decl) {
834
- DWARFMangling = true ;
835
834
OptimizeProtocolNames = false ;
836
- return mangleDeclAsUSR (decl, MANGLING_PREFIX_STR);
835
+
836
+ beginMangling ();
837
+ appendEntity (decl);
838
+ return finalize ();
837
839
}
838
840
839
841
std::string ASTMangler::mangleGenericSignature (const GenericSignature sig) {
Original file line number Diff line number Diff line change @@ -2939,7 +2939,9 @@ TypeRepr *ValueDecl::getOpaqueResultTypeRepr() const {
2939
2939
2940
2940
OpaqueTypeDecl *ValueDecl::getOpaqueResultTypeDecl () const {
2941
2941
if (getOpaqueResultTypeRepr () == nullptr ) {
2942
- if (isa<ModuleDecl>(this ))
2942
+ if (!isa<VarDecl>(this ) &&
2943
+ !isa<FuncDecl>(this ) &&
2944
+ !isa<SubscriptDecl>(this ))
2943
2945
return nullptr ;
2944
2946
auto file = cast<FileUnit>(getDeclContext ()->getModuleScopeContext ());
2945
2947
// Don't look up when the decl is from source, otherwise a cycle will happen.
Original file line number Diff line number Diff line change
1
+ @available ( macOS 10 . 8 , * )
2
+ @_originallyDefinedIn ( module: " CoreSoup " , macOS 10 . 10 )
3
+ public struct Vegetable {
4
+ public init ( ) { }
5
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+
3
+ // RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/CoreVegetable.swiftinterface %S/Inputs/CoreVegetable.swift -disable-availability-checking -enable-library-evolution -swift-version 5
4
+ // RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/CoreChef.swiftinterface -module-name CoreChef %s -I %t -disable-availability-checking -enable-library-evolution -swift-version 5 -DLIB
5
+
6
+ // RUN: %FileCheck %s < %t/CoreChef.swiftinterface
7
+
8
+ // REQUIRES: OS=macosx
9
+ import CoreVegetable
10
+
11
+ public protocol Soup { }
12
+
13
+ public struct VegetableSoup : Soup { }
14
+
15
+ public protocol Chef {
16
+ associatedtype Food
17
+
18
+ func cookSoup( _: Vegetable ) -> Food
19
+ }
20
+
21
+ public struct SoupChef : Chef {
22
+ public func cookSoup( _: Vegetable ) -> some Soup { VegetableSoup ( ) }
23
+ }
24
+
25
+ // CHECK-LABEL: public typealias Food = @_opaqueReturnTypeOf("$s8CoreChef04SoupB0V04cookC0yQr0aC09VegetableVF", 0) __
You can’t perform that action at this time.
0 commit comments