Skip to content

Commit aa2270a

Browse files
committed
Cope with concurrency-related function type adjustments in calls to "super".
Fixes rdar://96545062.
1 parent 8ff7e0b commit aa2270a

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
@@ -1282,7 +1282,10 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
12821282
CanType superFormalType = arg->getType()->getCanonicalType();
12831283

12841284
// The callee for a super call has to be either a method or constructor.
1285+
// There might be one level of conversion in between.
12851286
Expr *fn = apply->getFn();
1287+
if (auto fnConv = dyn_cast<FunctionConversionExpr>(fn))
1288+
fn = fnConv->getSubExpr();
12861289
SubstitutionMap substitutions;
12871290
SILDeclRef constant;
12881291
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)