File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -2857,10 +2857,21 @@ CanType ASTMangler::getDeclTypeForMangling(
2857
2857
return C.TheErrorType ;
2858
2858
}
2859
2859
2860
+ Type ty = decl->getInterfaceType ()->getReferenceStorageReferent ();
2861
+
2862
+ // Strip the global actor out of the mangling.
2863
+ ty = ty.transform ([](Type type) {
2864
+ if (auto fnType = type->getAs <AnyFunctionType>()) {
2865
+ if (fnType->getGlobalActor ()) {
2866
+ return Type (fnType->withExtInfo (
2867
+ fnType->getExtInfo ().withGlobalActor (Type ())));
2868
+ }
2869
+ }
2870
+
2871
+ return type;
2872
+ });
2860
2873
2861
- auto canTy = decl->getInterfaceType ()
2862
- ->getReferenceStorageReferent ()
2863
- ->getCanonicalType ();
2874
+ auto canTy = ty->getCanonicalType ();
2864
2875
2865
2876
if (auto gft = dyn_cast<GenericFunctionType>(canTy)) {
2866
2877
genericSig = gft.getGenericSignature ();
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -enable-experimental-concurrency | %FileCheck %s
2
+ // REQUIRES: concurrency
3
+
4
+ // Declarations don't mangle global actor types.
5
+ // CHECK: @$s4test10returnsOptyxycSgAClF
6
+ func returnsOpt< R> ( _ fn: ( @MainActor ( ) -> R ) ? ) -> ( ( ) -> R ) ? {
7
+ typealias Fn = ( ( ) -> R ) ?
8
+ return unsafeBitCast ( fn, to: Fn . self)
9
+ }
You can’t perform that action at this time.
0 commit comments