simplify adjustLValueForReference: now it *only* changes @inout arguments to be

implicit lvalues when referenced, so it can be simplified.


Swift SVN r11709
This commit is contained in:
Chris Lattner
2013-12-29 04:52:58 +00:00
parent 18a9193452
commit 78f765f5f8
6 changed files with 10 additions and 20 deletions

View File

@@ -655,8 +655,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
openType(valueType,
value->getPotentialGenericDeclContext(),
/*skipProtocolSelfConstraint=*/false,
opener),
value->getAttrs().isAssignment());
opener));
return { valueType, valueType };
}
@@ -986,9 +985,8 @@ void ConstraintSystem::addOverloadSet(Type boundType,
/// \brief Retrieve the fully-materialized form of the given type.
static Type getMateralizedType(Type type, ASTContext &context) {
if (auto lvalue = type->getAs<LValueType>()) {
if (auto lvalue = type->getAs<LValueType>())
return lvalue->getObjectType();
}
if (auto tuple = type->getAs<TupleType>()) {
bool anyChanged = false;
@@ -1020,7 +1018,7 @@ static Type getMateralizedType(Type type, ASTContext &context) {
void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
Type boundType,
OverloadChoice choice){
// Determie the type to which we'll bind the overload set's type.
// Determine the type to which we'll bind the overload set's type.
Type refType;
Type openedFullType;
switch (choice.getKind()) {
@@ -1052,10 +1050,6 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
// getTypeOfMemberReference(); their result types are optional.
if (!isa<SubscriptDecl>(choice.getDecl()))
refType = OptionalType::get(refType->getRValueType());
} else {
// Otherwise, adjust the lvalue type for this reference.
bool isAssignment = choice.getDecl()->getAttrs().isAssignment();
refType = adjustLValueForReference(refType, isAssignment);
}
break;