Commit Graph

11 Commits

Author SHA1 Message Date
Dmitri Hrybenko
d938b93e48 stdlib: doc comment: use monospaced font for code
rdar://20843980

Swift SVN r28255
2015-05-07 04:59:50 +00:00
Chris Lattner
85d681a5b6 strength reduce some non-performance sensitive code :-)
Like the FIXME comment states, this method should probably
be changed to be:

  public func getMirror() -> MirrorType {
    return _OptionalMirror<T>(self)
  }

but I don't know how to test that change.



Swift SVN r28157
2015-05-05 05:48:54 +00:00
Chris Lattner
6a5009e0ce implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond
Two pieces to this: 
 - Peephole OptionalEvaluationExpr(InjectOptionalExpr(BindOptionalExpr(X))) to  bitcast x to the result type. 
 - Enhance OptionalEvaluationExpr to delete the failure block if not needed.  

This is the same as r28150, but it includes a fix for the case when a non-address-only type
is initializing a contextally-provided-and-addressible buffer, tested by the new 
testContextualInitOfNonAddrOnlyType testcase.



Swift SVN r28153
2015-05-05 05:39:17 +00:00
Chris Lattner
9eb115fadf revert r28150, the perftestsuite isn't happy.
Swift SVN r28151
2015-05-05 05:16:23 +00:00
Chris Lattner
1ffe86b327 implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond
Two pieces to this:
 - Peephole OptionalEvaluationExpr(InjectOptionalExpr(BindOptionalExpr(X))) to 
   bitcast x to the result type.
 - Enhance OptionalEvaluationExpr to delete the failure block if not needed.

This is the same as r28111, except that we finalize the initialization in the
address-only case.  A reduced testcase for the specific issue is added to
optional-casts.swift.



Swift SVN r28150
2015-05-05 05:01:22 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
David Farler
9e28dc777a Update standard library doc comments to Markdown
rdar://problem/20180478

Swift SVN r27726
2015-04-26 00:07:11 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +00:00
Dmitri Hrybenko
4387f95a29 flatMap: fix the comment and simplify the implementation
rdar://20178405

Swift SVN r26205
2015-03-17 00:39:41 +00:00
Chris Lattner
20f8f09ea8 Land: <rdar://problem/19382905> improve 'if let' to support refutable patterns and untie it from optionals
This changes 'if let' conditions to take general refutable patterns, instead of
taking a irrefutable pattern and implicitly matching against an optional.

Where before you might have written:
  if let x = foo() {

you now need to write:
  if let x? = foo() {
    
The upshot of this is that you can write anything in an 'if let' that you can
write in a 'case let' in a switch statement, which is pretty general.

To aid with migration, this special cases certain really common patterns like
the above (and any other irrefutable cases, like "if let (a,b) = foo()", and
tells you where to insert the ?.  It also special cases type annotations like
"if let x : AnyObject = " since they are no longer allowed.

For transitional purposes, I have intentionally downgraded the most common
diagnostic into a warning instead of an error.  This means that you'll get:

t.swift:26:10: warning: condition requires a refutable pattern match; did you mean to match an optional?
if let a = f() {
       ^
        ?

I think this is important to stage in, because this is a pretty significant
source breaking change and not everyone internally may want to deal with it
at the same time.  I filed 20166013 to remember to upgrade this to an error.

In addition to being a nice user feature, this is a nice cleanup of the guts
of the compiler, since it eliminates the "isConditional()" bit from
PatternBindingDecl, along with the special case logic in the compiler to handle
it (which variously added and removed Optional around these things).




Swift SVN r26150
2015-03-15 07:06:22 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
2015-03-09 05:26:05 +00:00