Skip to content

[CSGen] Removing code that was only necessary for failure diagnostics #36792

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 1 commit into from
Apr 12, 2021
Merged
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
23 changes: 0 additions & 23 deletions lib/Sema/CSGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,29 +1253,6 @@ namespace {
CS.setFavoredType(E, knownType.getPointer());
}
}

// This can only happen when failure diagnostics is trying
// to type-check expressions inside of a single-statement
// closure which refer to anonymous parameters, in this case
// let's either use type as written or allocate a fresh type
// variable, just like we do for closure type.
// FIXME: We should eliminate this case.
if (auto *PD = dyn_cast<ParamDecl>(VD)) {
if (!CS.hasType(PD)) {
if (knownType &&
(knownType->hasUnboundGenericType() ||
knownType->hasPlaceholder())) {
knownType = CS.replaceInferableTypesWithTypeVars(knownType,
locator);
}

CS.setType(
PD, knownType ? knownType
: CS.createTypeVariable(locator,
TVO_CanBindToLValue |
TVO_CanBindToNoEscape));
}
}
}

// If declaration is invalid, let's turn it into a potential hole
Expand Down