@@ -3938,19 +3938,22 @@ void AttributeChecker::visitPropertyWrapperAttr(PropertyWrapperAttr *attr) {
3938
3938
void AttributeChecker::visitResultBuilderAttr (ResultBuilderAttr *attr) {
3939
3939
auto *nominal = dyn_cast<NominalTypeDecl>(D);
3940
3940
auto &ctx = D->getASTContext ();
3941
- SmallVector<ValueDecl *, 4 > potentialMatches;
3941
+ SmallVector<ValueDecl *, 4 > buildBlockMatches;
3942
+ SmallVector<ValueDecl *, 4 > buildPartialBlockFirstMatches;
3943
+ SmallVector<ValueDecl *, 4 > buildPartialBlockAccumulatedMatches;
3944
+
3942
3945
bool supportsBuildBlock = TypeChecker::typeSupportsBuilderOp (
3943
3946
nominal->getDeclaredType (), nominal, ctx.Id_buildBlock ,
3944
- /* argLabels=*/ {}, &potentialMatches);
3947
+ /* argLabels=*/ {}, &buildBlockMatches);
3948
+
3945
3949
bool supportsBuildPartialBlock =
3946
3950
TypeChecker::typeSupportsBuilderOp (
3947
- nominal->getDeclaredType (), nominal,
3948
- ctx.Id_buildPartialBlock ,
3949
- /* argLabels=*/ {ctx.Id_first }, &potentialMatches) &&
3951
+ nominal->getDeclaredType (), nominal, ctx.Id_buildPartialBlock ,
3952
+ /* argLabels=*/ {ctx.Id_first }, &buildPartialBlockFirstMatches) &&
3950
3953
TypeChecker::typeSupportsBuilderOp (
3951
- nominal->getDeclaredType (), nominal,
3952
- ctx.Id_buildPartialBlock ,
3953
- /* argLabels= */ {ctx. Id_accumulated , ctx. Id_next }, &potentialMatches );
3954
+ nominal->getDeclaredType (), nominal, ctx. Id_buildPartialBlock ,
3955
+ /* argLabels= */ { ctx.Id_accumulated , ctx. Id_next } ,
3956
+ &buildPartialBlockAccumulatedMatches );
3954
3957
3955
3958
if (!supportsBuildBlock && !supportsBuildPartialBlock) {
3956
3959
{
@@ -3964,7 +3967,7 @@ void AttributeChecker::visitResultBuilderAttr(ResultBuilderAttr *attr) {
3964
3967
Type componentType;
3965
3968
std::tie (buildInsertionLoc, stubIndent, componentType) =
3966
3969
determineResultBuilderBuildFixItInfo (nominal);
3967
- if (buildInsertionLoc.isValid () && potentialMatches .empty ()) {
3970
+ if (buildInsertionLoc.isValid () && buildBlockMatches .empty ()) {
3968
3971
std::string fixItString;
3969
3972
{
3970
3973
llvm::raw_string_ostream out (fixItString);
@@ -3980,7 +3983,7 @@ void AttributeChecker::visitResultBuilderAttr(ResultBuilderAttr *attr) {
3980
3983
3981
3984
// For any close matches, attempt to explain to the user why they aren't
3982
3985
// valid.
3983
- for (auto *member : potentialMatches ) {
3986
+ for (auto *member : buildBlockMatches ) {
3984
3987
if (member->isStatic () && isa<FuncDecl>(member))
3985
3988
continue ;
3986
3989
0 commit comments