Enable "omit needless words" by default.

Most of this is in updating the standard library, SDK overlays, and
piles of test cases to use the new names. No surprises here, although
this shows us some potential heuristic tweaks.

There is one substantive compiler change that needs to be factored out
involving synthesizing calls to copyWithZone()/copy(zone:). Aside from
that, there are four failing tests:

    Swift :: ClangModules/objc_parse.swift
    Swift :: Interpreter/SDK/Foundation_test.swift
    Swift :: Interpreter/SDK/archiving_generic_swift_class.swift
    Swift :: Interpreter/SDK/objc_currying.swift

due to two independent remaining compiler bugs:
  * We're not getting partial ordering between NSCoder's
  encode(AnyObject, forKey: String) and NSKeyedArchiver's version of
  that method, and
  * Dynamic lookup (into AnyObject) doesn't know how to find the new
  names. We need the Swift name lookup tables enabled to address this.
This commit is contained in:
Doug Gregor
2015-12-11 14:46:50 -08:00
parent d610fa0d1c
commit 06c5e9cd5b
101 changed files with 951 additions and 977 deletions

View File

@@ -651,7 +651,7 @@ static ProtocolDecl *getNSCopyingProtocol(TypeChecker &TC,
/// Synthesize the code to store 'Val' to 'VD', given that VD has an @NSCopying
/// attribute on it. We know that VD is a stored property in a class, so we
/// just need to generate something like "self.property = val.copyWithZone(nil)"
/// just need to generate something like "self.property = val.copy(zone: nil)"
/// here. This does some type checking to validate that the call will succeed.
static Expr *synthesizeCopyWithZoneCall(Expr *Val, VarDecl *VD,
TypeChecker &TC) {
@@ -684,15 +684,16 @@ static Expr *synthesizeCopyWithZoneCall(Expr *Val, VarDecl *VD,
// Generate:
// (force_value_expr type='<null>'
// (call_expr type='<null>'
// (unresolved_dot_expr type='<null>' field 'copyWithZone'
// (unresolved_dot_expr type='<null>' field 'copy'
// "Val")
// (paren_expr type='<null>'
// (nil_literal_expr type='<null>'))))
auto UDE = new (Ctx) UnresolvedDotExpr(Val, SourceLoc(),
Ctx.getIdentifier("copyWithZone"),
Ctx.getIdentifier("copy"),
SourceLoc(), /*implicit*/true);
Expr *Nil = new (Ctx) NilLiteralExpr(SourceLoc(), /*implicit*/true);
Nil = new (Ctx) ParenExpr(SourceLoc(), Nil, SourceLoc(), false);
Nil = TupleExpr::create(Ctx, SourceLoc(), { Nil }, { Ctx.Id_zone },
{ SourceLoc() }, SourceLoc(), false, true);
//- (id)copyWithZone:(NSZone *)zone;
Expr *Call = new (Ctx) CallExpr(UDE, Nil, /*implicit*/true);