mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user