Commit Graph

35 Commits

Author SHA1 Message Date
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Dmitri Gribenko
e2f5e05ec4 stdlib: Streamable.writeTo() => .write(to:) 2016-02-22 18:16:37 -08:00
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Dmitri Gribenko
0e1c488f9a stdlib: print, debugPrint: 'toStream:' => 'to:' 2016-02-15 23:48:02 -08:00
Max Moiseev
08e1e4a043 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-11 16:51:11 -08:00
Andrew Trick
bb2a590593 Improve an Optional casting unit test.
Just test the cast, don't rely on the implementation of printing.
2016-01-09 22:39:52 -08:00
Andrew Trick
9cf84c24ca Fix a leak when interpolating optional references.
The runtime support for casting optionals introduced in 35cb1afa
resulted in a redundant retain.

Fixes SR-459: Weakened optionals don't zero...
rdar://24057977.
2016-01-08 13:51:02 -08:00
Max Moiseev
a7339e67ac Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-22 11:36:07 -08:00
Chris Lattner
82e5c0c592 Update various tests to stop using ++/-- 2015-12-21 18:07:37 -08:00
Dmitri Gribenko
2245f7505f func _unsafeUnwrap() => var _unsafelyUnwrapped 2015-12-18 16:20:01 -08:00
Maxim Moiseev
ee7d55f74b moving unsafeUnwrap into Optional 2015-12-16 17:24:12 -08:00
Max Moiseev
fca25fbeb9 Comment improvements and test fixes 2015-12-16 15:29:52 -08:00
Dmitri Gribenko
63cbe16b68 Rename Memory to Pointee in generic parameter names
UnsafePointer<Memory> => UnsafePointer<Pointee>
UnsafeMutablePointer<Memory> => UnsafeMutablePointer<Pointee>
AutoreleasingUnsafeMutablePointer<Memory> =>
  AutoreleasingUnsafeMutablePointer<Pointee>
2015-12-16 14:54:36 -08:00
Erik Eckstein
0830c36974 [tests] add import statements to prevent unresolved symbols when compiling StdlibUnittest with -sil-serialize-all.
This is the second part of 308f39fe56.
It fixes (better: works-around) linker errors when testing in optimized mode.
2015-12-15 10:46:10 -08:00
Andrew Trick
3ff7be799f Fix my own comment typo. 2015-12-14 11:29:46 -08:00
practicalswift
16eb0ef41f Fix typo: implemention → implementation 2015-12-14 00:11:53 +01:00
Arsen Gasparyan
ea46807813 Migrate FileCheck tests to StdlibUnittest 2015-12-11 20:55:14 +03:00
Arsen Gasparyan
da1cdf2f47 Improving code style 2015-12-11 20:05:05 +03:00
Arsen Gasparyan
7b20eec211 Rewrite some test cases with StdlibUnittest 2015-12-11 20:05:05 +03:00
Arsen Gasparyan
1a5fea5c47 Fix if-else formatting 2015-12-11 01:23:33 +03:00
Arsen Gasparyan
4fa0bcbfb2 Remove unused variable 2015-12-10 22:49:24 +03:00
Andrew Trick
35cb1afab8 Fix dynamic runtime casts of Optionals.
Fixes <rdar://23122310> Runtime dynamic casts...

This makes runtime dynamic casts consistent with language rules, and
consequently makes specialization of generic code consistent with an
equivalent nongeneric implementation.

The runtime now supports casts from Optional<T> to U. Naturally the
cast fails on nil source, but otherwise succeeds if T is convertible to
U.

When casting T to Optional<U> the runtime succeeds whenever T is
convertible to U and simply wraps the result in an Optional.

To greatly simplify the runtime, I am assuming that
target-type-specific runtime cast entry points
(e.g. swift_dynamicCastClass) are never invoked with an optional
source. This assumption is valid for the following reasons. At the
language level optionals must be unwrapped before downcasting (via
as[?!]), so we only need to worry about SIL and IR lowering.  This
implementation assumes (with asserts) that:

- SIL promotion from an address cast to a value casts should only happen
  when the source is nonoptional. Handling optional unwrapping in SIL
  would be too complicated because we need to check for Optional's own
  conformances. (I added a test case to ensure this promotion does not
  happen). This is not an issue for unchecked_ref_cast, which
  implicitly unwraps optionals, so we can promote those!

- IRGen lowers unchecked_ref_cast (Builtin.castReference) directly to
  a bitcast (will be caught by asserts).

- IRGen continues to emit the generic dynamicCast entry point for
  address-casts (will be caught by asserts).
2015-12-09 16:12:30 -08:00
David Farler
a759ca9141 Disallow 'var' bindings in case patterns
Make the following illegal:

switch thing {
  case .A(var x):
    modify(x0
}

And provide a replacement 'var' -> 'let' fix-it.

rdar://problem/23172698

Swift SVN r32883
2015-10-25 18:53:02 +00:00
Dmitri Hrybenko
14466151eb stdlib: rename ImplicitlyUnwrappedOptional's parameter to Wrapped
We renamed the parameter of Optional, but missed
ImplicitlyUnwrappedOptional.

rdar://22332469

Swift SVN r31315
2015-08-18 22:33:10 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Dave Abrahams
1f3bf276db Warning suppression in tests
Swift SVN r30751
2015-07-29 02:04:12 +00:00
Doug Gregor
54979b70a7 Remove uses of complete-unnamed function parameters from the testsuite.
Support for "func f(Int)" is going away.

Swift SVN r29608
2015-06-24 16:01:37 +00:00
Arnold Schwaighofer
859fbc0162 More executable_test for the test directory
Swift SVN r29280
2015-06-03 23:28:51 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Dmitri Hrybenko
da3e3268e0 tests: use more precise StdlibUnittest assertions
Swift SVN r26204
2015-03-17 00:39:39 +00:00
Graham Batty
0a73f54e98 Implement a glibc module for StdlibUnittest on linux
Swift SVN r25807
2015-03-06 22:05:13 +00:00
Graham Batty
7346a9733d Update test and validation-test flags for linux.
Swift SVN r25506
2015-02-24 18:55:42 +00:00
Maxwell Swadling
b1857d2452 [stdlib] added flatMap
fixes rdar://problem/19338087

Swift SVN r25378
2015-02-18 22:58:35 +00:00
Jordan Rose
e83c117c30 [test] Hack: run stdlib tests first to start long-running tests earlier.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.

Swift SVN r22745
2014-10-15 01:30:51 +00:00