@@ -409,6 +409,7 @@ namespace {
409
409
ConstraintLocatorBuilder locator, bool implicit,
410
410
FunctionRefKind functionRefKind,
411
411
AccessSemantics semantics) {
412
+ assert (choice.getKind () != OverloadChoiceKind::DeclViaDynamic);
412
413
auto *decl = choice.getDecl ();
413
414
414
415
// Determine the declaration selected for this overloaded reference.
@@ -486,8 +487,7 @@ namespace {
486
487
487
488
return buildMemberRef (base, openedType, SourceLoc (), choice, loc,
488
489
openedFnType->getResult (), locator, locator,
489
- implicit, functionRefKind, semantics,
490
- /* isDynamic=*/ false );
490
+ implicit, functionRefKind, semantics);
491
491
}
492
492
493
493
auto type = solution.simplifyType (openedType);
@@ -760,7 +760,7 @@ namespace {
760
760
Type openedType, ConstraintLocatorBuilder locator,
761
761
ConstraintLocatorBuilder memberLocator, bool Implicit,
762
762
FunctionRefKind functionRefKind,
763
- AccessSemantics semantics, bool isDynamic ) {
763
+ AccessSemantics semantics) {
764
764
ValueDecl *member = choice.getDecl ();
765
765
766
766
auto &context = cs.getASTContext ();
@@ -860,6 +860,7 @@ namespace {
860
860
semantics = getImplicitMemberReferenceAccessSemantics (base, VD, dc);
861
861
}
862
862
863
+ auto isDynamic = choice.getKind () == OverloadChoiceKind::DeclViaDynamic;
863
864
if (baseIsInstance) {
864
865
// Convert the base to the appropriate container type, turning it
865
866
// into an lvalue if required.
@@ -2346,14 +2347,11 @@ namespace {
2346
2347
auto memberLocator = cs.getConstraintLocator (expr,
2347
2348
ConstraintLocator::Member);
2348
2349
auto selected = solution.getOverloadChoice (memberLocator);
2349
- bool isDynamic
2350
- = selected.choice .getKind () == OverloadChoiceKind::DeclViaDynamic;
2351
2350
return buildMemberRef (
2352
2351
expr->getBase (), selected.openedFullType , expr->getDotLoc (),
2353
2352
selected.choice , expr->getNameLoc (), selected.openedType ,
2354
2353
cs.getConstraintLocator (expr), memberLocator, expr->isImplicit (),
2355
- selected.choice .getFunctionRefKind (), expr->getAccessSemantics (),
2356
- isDynamic);
2354
+ selected.choice .getFunctionRefKind (), expr->getAccessSemantics ());
2357
2355
}
2358
2356
2359
2357
Expr *visitDynamicMemberRefExpr (DynamicMemberRefExpr *expr) {
@@ -2393,15 +2391,12 @@ namespace {
2393
2391
cs.cacheExprTypes (base);
2394
2392
2395
2393
// Build the member reference.
2396
- bool isDynamic
2397
- = selected.choice .getKind () == OverloadChoiceKind::DeclViaDynamic;
2398
2394
auto *exprLoc = cs.getConstraintLocator (expr);
2399
2395
auto result = buildMemberRef (
2400
2396
base, selected.openedFullType , expr->getDotLoc (), selected.choice ,
2401
2397
expr->getNameLoc (), selected.openedType ,
2402
2398
exprLoc, memberLocator, expr->isImplicit (),
2403
- selected.choice .getFunctionRefKind (), AccessSemantics::Ordinary,
2404
- isDynamic);
2399
+ selected.choice .getFunctionRefKind (), AccessSemantics::Ordinary);
2405
2400
if (!result)
2406
2401
return nullptr ;
2407
2402
@@ -2538,7 +2533,7 @@ namespace {
2538
2533
ConstraintLocator *ctorLocator,
2539
2534
OverloadChoice choice,
2540
2535
FunctionRefKind functionRefKind, Type openedType) {
2541
-
2536
+ assert (choice. getKind () != OverloadChoiceKind::DeclViaDynamic);
2542
2537
auto *ctor = cast<ConstructorDecl>(choice.getDecl ());
2543
2538
2544
2539
// If the subexpression is a metatype, build a direct reference to the
@@ -2547,8 +2542,7 @@ namespace {
2547
2542
return buildMemberRef (
2548
2543
base, openedType, dotLoc, choice, nameLoc, cs.getType (expr),
2549
2544
ConstraintLocatorBuilder (cs.getConstraintLocator (expr)),
2550
- ctorLocator, implicit, functionRefKind, AccessSemantics::Ordinary,
2551
- /* isDynamic=*/ false );
2545
+ ctorLocator, implicit, functionRefKind, AccessSemantics::Ordinary);
2552
2546
}
2553
2547
2554
2548
// The subexpression must be either 'self' or 'super'.
@@ -2672,15 +2666,12 @@ namespace {
2672
2666
2673
2667
case OverloadChoiceKind::Decl:
2674
2668
case OverloadChoiceKind::DeclViaUnwrappedOptional:
2675
- case OverloadChoiceKind::DeclViaDynamic: {
2676
- bool isDynamic
2677
- = selected.choice .getKind () == OverloadChoiceKind::DeclViaDynamic;
2669
+ case OverloadChoiceKind::DeclViaDynamic:
2678
2670
return buildMemberRef (base, selected.openedFullType , dotLoc,
2679
2671
selected.choice , nameLoc, selected.openedType ,
2680
2672
cs.getConstraintLocator (expr), memberLocator,
2681
2673
implicit, selected.choice .getFunctionRefKind (),
2682
- AccessSemantics::Ordinary, isDynamic);
2683
- }
2674
+ AccessSemantics::Ordinary);
2684
2675
2685
2676
case OverloadChoiceKind::TupleIndex: {
2686
2677
Type toType = simplifyType (cs.getType (expr));
@@ -6617,12 +6608,11 @@ static Expr *finishApplyCallAsFunctionMethod(
6617
6608
auto *fn = apply->getFn ();
6618
6609
auto choice = selected.choice ;
6619
6610
// Create direct reference to `callAsFunction` method.
6620
- bool isDynamic = choice.getKind () == OverloadChoiceKind::DeclViaDynamic;
6621
6611
auto *declRef = rewriter.buildMemberRef (
6622
6612
fn, selected.openedFullType , /* dotLoc*/ SourceLoc (), choice,
6623
6613
DeclNameLoc (fn->getEndLoc ()), selected.openedType , applyFunctionLoc,
6624
6614
applyFunctionLoc, /* implicit*/ true , choice.getFunctionRefKind (),
6625
- AccessSemantics::Ordinary, isDynamic );
6615
+ AccessSemantics::Ordinary);
6626
6616
if (!declRef)
6627
6617
return nullptr ;
6628
6618
declRef->setImplicit (apply->isImplicit ());
@@ -6668,14 +6658,12 @@ ExprRewriter::finishApplyDynamicCallable(ApplyExpr *apply,
6668
6658
bool useKwargsMethod = argumentLabel == ctx.Id_withKeywordArguments ;
6669
6659
6670
6660
// Construct expression referencing the `dynamicallyCall` method.
6671
- bool isDynamic =
6672
- selected.choice .getKind () == OverloadChoiceKind::DeclViaDynamic;
6673
6661
auto member = buildMemberRef (fn, selected.openedFullType ,
6674
6662
SourceLoc (), selected.choice ,
6675
6663
DeclNameLoc (method->getNameLoc ()),
6676
6664
selected.openedType , loc, loc, /* implicit*/ true ,
6677
6665
selected.choice .getFunctionRefKind (),
6678
- AccessSemantics::Ordinary, isDynamic );
6666
+ AccessSemantics::Ordinary);
6679
6667
6680
6668
// Construct argument to the method (either an array or dictionary
6681
6669
// expression).
@@ -7022,15 +7010,14 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, ConcreteDeclRef callee,
7022
7010
7023
7011
// Consider the constructor decl reference expr 'implicit', but the
7024
7012
// constructor call expr itself has the apply's 'implicitness'.
7025
- bool isDynamic = choice.getKind () == OverloadChoiceKind::DeclViaDynamic;
7026
7013
auto ctorRef = resolveConcreteDeclRef (choice.getDecl (), ctorLocator);
7027
7014
Expr *declRef = buildMemberRef (fn, selected->openedFullType ,
7028
7015
/* dotLoc=*/ SourceLoc (), choice,
7029
7016
DeclNameLoc (fn->getEndLoc ()),
7030
7017
selected->openedType , locator, ctorLocator,
7031
7018
/* Implicit=*/ true ,
7032
7019
choice.getFunctionRefKind (),
7033
- AccessSemantics::Ordinary, isDynamic );
7020
+ AccessSemantics::Ordinary);
7034
7021
if (!declRef)
7035
7022
return nullptr ;
7036
7023
declRef->setImplicit (apply->isImplicit ());
0 commit comments