Skip to content

Commit 6fa89b7

Browse files
Merge pull request #40315 from nate-chandler/rdar84962693
[Sema] Made $main non-dynamic.
2 parents a89955b + 4b8747e commit 6fa89b7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,9 @@ SynthesizeMainFunctionRequest::evaluate(Evaluator &evaluator,
20942094
/*GenericParams=*/nullptr, ParameterList::createEmpty(context),
20952095
/*FnRetType=*/TupleType::getEmpty(context), declContext);
20962096
func->setSynthesized(true);
2097+
// It's never useful to provide a dynamic replacement of this function--it is
2098+
// just a pass-through to MainType.main.
2099+
func->setIsDynamic(false);
20972100

20982101
auto *params = context.Allocate<MainTypeAttrParams>();
20992102
params->mainFunction = mainFunction;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %target-swift-frontend -c -parse-as-library %s -enable-implicit-dynamic
2+
3+
@main
4+
struct BasicAppApp {
5+
static func main() {}
6+
}

0 commit comments

Comments
 (0)