Skip to content

Cope with concurrency-related function type adjustments in calls to "super". #59949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/SILGen/SILGenApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,10 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
CanType superFormalType = arg->getType()->getCanonicalType();

// The callee for a super call has to be either a method or constructor.
// There might be one level of conversion in between.
Expr *fn = apply->getFn();
if (auto fnConv = dyn_cast<FunctionConversionExpr>(fn))
fn = fnConv->getSubExpr();
SubstitutionMap substitutions;
SILDeclRef constant;
if (auto *ctorRef = dyn_cast<OtherConstructorDeclRefExpr>(fn)) {
Expand Down
24 changes: 24 additions & 0 deletions test/SILGen/global_actor_functions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -disable-availability-checking | %FileCheck --enable-var-scope %s
// REQUIRES: concurrency

actor MyActor { }

@globalActor
struct GlobalActor {
static var shared: MyActor = MyActor()
}

@GlobalActor
class Super {
func f() { }
}

@GlobalActor
class Sub: Super {
// CHECK-LABEL: sil hidden [ossa] @$s4test3SubC1fyyF : $@convention(method) (@guaranteed Sub) -> ()
// CHECK: function_ref @$s4test5SuperC1fyyF
// CHECK-NEXT: apply
override func f() {
super.f()
}
}