Commit Graph

41 Commits

Author SHA1 Message Date
Jordan Rose
b71f7440f0 stdlib: Rename cases in XCTest._XCTThrowableBlockResult.
This is a non-public enum, so there's no migration needed.
2016-02-24 17:46:11 -08:00
Max Moiseev
40b1a0b7e0 [stdlib] all sorts of require renamed back to precondition 2016-02-19 18:21:29 -08:00
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Chris Lattner
0619e57a61 Switch the stdlib to use #file instead of __FILE__, and deprecate the __FILE__ identifiers.
This also updates the tests that would otherwise fail.
2016-02-04 15:08:31 -08:00
Doug Gregor
7d70b704e4 Merge commit '5e11e3f7287427d386636a169c4065c0373931a8' into swift-3-api-guidelines 2016-01-19 23:18:20 -08:00
Chris Hanson
d2e5887469 XCTest Overlay: Treat ObjC exceptions as unexpected failures
When an assertion fails due to an Objective-C exception, that should be
treated as an unexpected failure, not an expected failure.

Addresses rdar://problem/24114025.
2016-01-15 16:37:48 -08:00
Chris Hanson
0e904b76a0 XCTest Overlay: Allow assertion expressions to throw
When an assertion expression throws an error, treat that as an
unexpected failure of the assertion.

Also generate the failure message for the error directly in the overlay,
rather than routing through _XCTFailureDescription, to avoid revlock
between the overlay and XCTest.framework's implementation.

Addresses rdar://problem/23789893.
2016-01-14 12:57:06 -08:00
Chris Hanson
bf6d7ada84 XCTest Overlay: Add XCTAssertThrowsError assertion
Add an assertion that can be used to check that an expression throws an
error, and if it does to run a block against that error which may
contain further checks.

Addresses rdar://problem/23789904.
2016-01-14 11:58:12 -08:00
Max Moiseev
08e1e4a043 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-11 16:51:11 -08:00
Pavel Mazurin
e0c6ac167c Add @autoclosure to message parameter, so it's constructed only if it's needed. 2016-01-08 20:49:48 +01:00
Brian Croom
a5ae9ddabe Use StaticString for file parameters in the XCTest overlay
Instead of just `String`. This makes it consistent with `fatalError`,
`assert`, etc., as well as `swift-corelibs-xctest`
2016-01-05 16:24:50 -05:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
8edde2c503 Runtime: Push swift_demangleSimpleClass into XCTest overlay.
The only place it's used.
2015-12-23 11:19:42 -08:00
Maxim Moiseev
e6468a0eca _precondition => _require 2015-12-16 17:19:01 -08:00
Maxim Moiseev
ca932fca5a CVarArgType => CVarArg 2015-12-16 15:52:01 -08:00
Maxim Moiseev
50fba4b770 floating point types renamed 2015-12-10 17:05:11 -08:00
Maxim Moiseev
2c95bb6d51 BooleanType => Boolean 2015-12-10 14:56:32 -08:00
Jawwad Ahmad
8f6f5ab0dd [stdlib] Remove trailing semicolons from files in stdlib 2015-12-04 15:50:13 +05:00
Joe Groff
fbd2e4d872 Rename @asmname to @_silgen_name.
This reflects the fact that the attribute's only for compiler-internal use, and isn't really equivalent to C's asm attribute, since it doesn't change the calling convention to be C-compatible.
2015-11-17 14:13:48 -08:00
Jordan Rose
6e1bf0d10d Rename @exported to @_exported for now.
At some point I want to propose a revised model for exports, but for now
just mark that support for '@exported' is still experimental and subject
to change. (Thanks, Max.)
2015-11-05 11:59:00 -08:00
Jordan Rose
53b1cf2b09 [CMake] Fix dependencies for CloudKit.
...which unfortunately meant splitting tvOS out from iOS.

Swift SVN r31343
2015-08-19 20:57:02 +00:00
Zoltan Foley-Fisher
4f87b6e8c5 Fix <rdar://problem/18063644> [SWIFT] XCTAssert(Non)Nil should work on any optional type
Swift SVN r30813
2015-07-30 20:40:10 +00:00
Zoltan Foley-Fisher
4a3b5bada3 <rdar://problem/17541074> [SWIFT] Should XCTAssertEqual and friends take optional/nullable types?
Now comparing optionals in XCTAssertEqual/XCTAssertNotEqual

Swift SVN r30516
2015-07-22 23:42:37 +00:00
Doug Gregor
17884f173a Stop declaring function parameters without names, e.g., "func f(Int)".
Swift SVN r29607
2015-06-24 16:01:31 +00:00
Jordan Rose
99768eb346 Revert "Switch overlays from using @exported to -import-underlying-module."
This reverts r29441 because it breaks the Linux build. I'll talk to Dmitri
about this tomorrow.

See rdar://problem/21254367

Swift SVN r29444
2015-06-17 05:02:21 +00:00
Jordan Rose
c8bfc87c4e Switch overlays from using @exported to -import-underlying-module.
Some day we'll close the hole for @exported in the previous commit.

Swift SVN r29441
2015-06-17 04:48:06 +00:00
Dmitri Hrybenko
29ec6ab6b5 Re-enable the XCTest overlay for OSX
And add the first smoketest for the XCTest overlay to prevent
regressions in future.

Swift SVN r29197
2015-06-01 01:09:31 +00:00
Dmitri Hrybenko
e878cdc153 Don't build the XCTest overlay for watchOS
XCTest for watchOS is not present in the public SDK.

Swift SVN r29156
2015-05-29 23:47:35 +00:00
Doug Gregor
d1c25ddeb9 Add missing dependency: XCTest depends on AppKit or UIKit.
Swift SVN r28947
2015-05-23 03:40:35 +00:00
Chris Lattner
c1df892d47 improve stdlib hygiene a bit.
Swift SVN r28392
2015-05-10 02:55:18 +00:00
David Farler
8c2248a482 Don't embed LLVM bitcode into the XCTest overlay
With bitcode enabled, the XCTest overlay fails to link because
XCTest.framework itself was not built with bitcode. For now, we should
not build this overlay with bitcode. It isn't embedded in apps.

rdar://problem/20884313

Swift SVN r28355
2015-05-09 01:28:05 +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
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Joe Groff
c0a2994564 AST: Start printing function types with @convention instead of old attributes.
And update tests to match.

Swift SVN r27262
2015-04-13 22:51:34 +00:00
Dmitri Hrybenko
ff2dd6320a stdlib: fix coding style
When colon specifies is-a relationship between types, we put spaces on
both sides of the colon.

Swift SVN r27016
2015-04-05 05:54:55 +00:00
Chris Lattner
7b13a367a7 clean up some uses of typed patterns in nested contexts. The only reason anyone was using
them was because of the obsolete AnyObject warning.


Swift SVN r26159
2015-03-15 18:26:24 +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