Commit Graph

23 Commits

Author SHA1 Message Date
Max Moiseev
a558d13a3b Revert "Replace Unmanaged with UnsafeReference"
This reverts commit d72932e931.
2016-02-15 17:13:40 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Doug Gregor
096b268a6e [Clang importer] Mark redundant "Ref" aliases of CF types as deprecated/unavailable.
The Clang importer generally imports a CF type under two names, one
with "Ref" and one without, which is needlessly redundant. Mark the
"Ref" versions as deprecated (with a rename to the non-"Ref" version)
now as a migration step toward removing them entirely (gated by
-enable-omit-needless-words). Fixes rdar://problem/16888940.
2016-02-02 10:40:09 -08:00
Dave Abrahams
d72932e931 Replace Unmanaged with UnsafeReference 2015-12-18 16:22:24 -08:00
Dmitri Gribenko
339c7a99dc Remove no-argument initializers from unsafe pointer types
The preferred way to create a nil pointer is to use the 'nil' literal.

Affected types:
AutoreleasingUnsafeMutablePointer
OpaquePointer
UnsafeMutablePointer
UnsafePointer
2015-12-16 14:59:50 -08:00
Chris Lattner
98169c5171 add fixit checks to ClangModules.
Swift SVN r31003
2015-08-04 20:29:37 +00:00
Jordan Rose
460b03d367 [ClangImporter] Remove a hack put in for the Security framework.
They've updated their headers and things are better now.

rdar://problem/19020927

Swift SVN r29588
2015-06-24 00:52:52 +00:00
Chris Lattner
e4b6afb9ae Start moving the testsuite to the "_ = foo()" idiom for evaluating an
expression but ignoring its value.  This is the right canonical way to do
this.  NFC, just testsuite changes.



Swift SVN r28638
2015-05-15 20:15:54 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +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
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
f43843f25c tests: use the new substitution for the mock SDK
This is required to correctly use the mock SDK when the SDK overlay is
built and tested separately.  (Otherwise, the mock SDK might not get
used, because the overlay SDK options would expand from the
%-substitution, appear first on the command line, and shadow the mock
SDK in the search path).

Swift SVN r25185
2015-02-11 18:57:29 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Chris Willmore
03a6190a1f <rdar://problem/19031957> Change failable casts from "as" to "as!"
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.

Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.

Swift SVN r24253
2015-01-08 00:33:59 +00:00
Chris Lattner
180e957063 reject all optional chains that don't chain anything. Thanks to Jordan and Joe for the feedback.
--This line, and those bel that ow, will be ignored--

M    test/Parse/optional.swift
M    test/ClangModules/Security_test.swift
M    test/expr/expressions.swift
M    include/swift/AST/DiagnosticsSema.def
M    lib/Sema/CSApply.cpp


Swift SVN r23685
2014-12-04 18:46:46 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Anna Zaks
7be3363210 Reapply Swift Overlay: Make most common security return codes work with OSStatus
This reverts commit 043dbaafa20f3a1bbb1c71cd748a651ad57ba7b4.

Swift SVN r21794
2014-09-09 01:47:03 +00:00
Anna Zaks
ecf471bbff Revert "Swift Overlay: Make most common security return codes work with OSStatus"
This is causing buildbot breakage while building the Security library.

Swift SVN r21761
2014-09-06 05:30:23 +00:00
Anna Zaks
d51c1736f0 Swift Overlay: Make most common security return codes work with OSStatus
Swift SVN r21759
2014-09-06 00:46:21 +00:00
Jordan Rose
8176e99f5a [ClangImporter] Special-case some known non-CF types whose names end in "Ref".
Without this, we try to bring these in as CF types, and then ARC tries to
manage them, and the program crashes.

<rdar://problem/17211521>

Swift SVN r21081
2014-08-07 01:18:26 +00:00
Jordan Rose
fe8e659667 [ClangImporter] Hack: import selected constants from Security as CFStrings.
This is a step towards making the framework easier to use in Swift; in the
actual headers, these are typed as "CFTypeRef" or "const CFTypeRef", which
is not considered Hashable (and thus cannot be put in a dictionary).
Unfortunately, CFStringRef is also not hashable, so we're not there yet,
but at least this allows a freer conversion to NSString.

Part of <rdar://problem/17162475>

Swift SVN r20931
2014-08-02 00:03:40 +00:00