Skip to content

Commit a12c9eb

Browse files
authored
Merge pull request #38645 from hamishknight/misc-sema-cleanups
2 parents 5bd6f80 + f8820d3 commit a12c9eb

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

lib/Sema/CSFix.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,7 @@ getStructuralTypeContext(const Solution &solution, ConstraintLocator *locator) {
428428
return std::make_tuple(CTP,
429429
solution.getType(assignExpr->getSrc()),
430430
solution.getType(assignExpr->getDest())->getRValueType());
431-
} else if (auto *call = getAsExpr<CallExpr>(locator->getAnchor())) {
432-
assert(isa<TypeExpr>(call->getFn()));
433-
return std::make_tuple(
434-
CTP_Initialization,
435-
solution.getType(call->getFn())->getMetatypeInstanceType(),
436-
solution.getType(call->getArg()));
437431
}
438-
439432
return None;
440433
}
441434

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3778,16 +3778,7 @@ static bool diagnoseContextualFunctionCallGenericAmbiguity(
37783778
TypeVariableType *typeVar) {
37793779
auto argParamMatch = argMatching->second.parameterBindings[argIdx];
37803780
auto param = applyFnType->getParams()[argParamMatch.front()];
3781-
if (param.isVariadic()) {
3782-
auto paramType = param.getParameterType();
3783-
// Variadic parameter is constructed as an ArraySliceType(which is
3784-
// just sugared type for a bound generic) with the closure type as
3785-
// element.
3786-
auto baseType = paramType->getDesugaredType()->castTo<BoundGenericType>();
3787-
auto paramFnType = baseType->getGenericArgs()[0]->castTo<FunctionType>();
3788-
return cs.typeVarOccursInType(typeVar, paramFnType->getResult());
3789-
}
3790-
auto paramFnType = param.getParameterType()->castTo<FunctionType>();
3781+
auto paramFnType = param.getPlainType()->castTo<FunctionType>();
37913782
return cs.typeVarOccursInType(typeVar, paramFnType->getResult());
37923783
};
37933784

lib/Sema/TypeCheckStmt.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,16 +1257,6 @@ static void diagnoseIgnoredLiteral(ASTContext &Ctx, LiteralExpr *LE) {
12571257
}
12581258

12591259
void TypeChecker::checkIgnoredExpr(Expr *E) {
1260-
// For parity with C, several places in the grammar accept multiple
1261-
// comma-separated expressions and then bind them together as an implicit
1262-
// tuple. Break these apart and check them separately.
1263-
if (E->isImplicit() && isa<TupleExpr>(E)) {
1264-
for (auto Elt : cast<TupleExpr>(E)->getElements()) {
1265-
checkIgnoredExpr(Elt);
1266-
}
1267-
return;
1268-
}
1269-
12701260
// Skip checking if there is no type, which presumably means there was a
12711261
// type error.
12721262
if (!E->getType()) {

0 commit comments

Comments
 (0)