Now that we have various infrastructure improvements in place, we can

remove some unprincipled code from typeCheckChildIndependently that was
special casing some expr nodes.


Swift SVN r31407
This commit is contained in:
Chris Lattner
2015-08-22 06:06:14 +00:00
parent 186fa8e9d6
commit 3a03435a1e
3 changed files with 36 additions and 45 deletions

View File

@@ -5091,6 +5091,19 @@ Expr *ExprRewriter::convertLiteral(Expr *literal,
Diag<> brokenBuiltinProtocolDiag) {
auto &tc = cs.getTypeChecker();
// If coercing a literal to an unresolved type, we don't try to look up the
// witness members, just do it.
if (type->is<UnresolvedType>()) {
// Instead of updating the literal expr in place, allocate a new node. This
// avoids issues where Builtin types end up on expr nodes and pollute
// diagnostics.
literal = cast<LiteralExpr>(literal)->shallowClone(tc.Context);
// The literal expression has this type.
literal->setType(type);
return literal;
}
// Check whether this literal type conforms to the builtin protocol.
ProtocolConformance *builtinConformance = nullptr;
if (builtinProtocol &&