Skip to content

Commit c8f4b09

Browse files
authored
Merge pull request #59949 from DougGregor/super-call-concurrency-adjust
Cope with concurrency-related function type adjustments in calls to "super".
2 parents b353723 + aa2270a commit c8f4b09

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,10 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
13031303
CanType superFormalType = arg->getType()->getCanonicalType();
13041304

13051305
// The callee for a super call has to be either a method or constructor.
1306+
// There might be one level of conversion in between.
13061307
Expr *fn = apply->getFn();
1308+
if (auto fnConv = dyn_cast<FunctionConversionExpr>(fn))
1309+
fn = fnConv->getSubExpr();
13071310
SubstitutionMap substitutions;
13081311
SILDeclRef constant;
13091312
if (auto *ctorRef = dyn_cast<OtherConstructorDeclRefExpr>(fn)) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -disable-availability-checking | %FileCheck --enable-var-scope %s
2+
// REQUIRES: concurrency
3+
4+
actor MyActor { }
5+
6+
@globalActor
7+
struct GlobalActor {
8+
static var shared: MyActor = MyActor()
9+
}
10+
11+
@GlobalActor
12+
class Super {
13+
func f() { }
14+
}
15+
16+
@GlobalActor
17+
class Sub: Super {
18+
// CHECK-LABEL: sil hidden [ossa] @$s4test3SubC1fyyF : $@convention(method) (@guaranteed Sub) -> ()
19+
// CHECK: function_ref @$s4test5SuperC1fyyF
20+
// CHECK-NEXT: apply
21+
override func f() {
22+
super.f()
23+
}
24+
}

0 commit comments

Comments
 (0)