Commit Graph

31 Commits

Author SHA1 Message Date
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Joe Groff
7535acc86b Make bridged String and collection types conform to CVarArg.
This allows String, Array, Dictionary, and Set to be passed as variadic arguments to Cocoa APIs like NSLog, NSPredicate, stringWithFormat:, etc. rdar://problem/27651717
2016-08-04 07:14:55 -07:00
Joe Groff
11f03cd8b5 Sema: Don't try bridged classes as default literal types.
One last bit of SE-0072. We shouldn't fall back to bridged classes in the absence of type context for literals anymore. By itself, this kind of hoses the use of literals with NS types, but I think we can get most of the QoI back with overlay changes I plan to propose following this.
2016-07-29 15:18:31 -07:00
Tony Parker
8e814ac875 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-17 09:42:37 -07:00
Andrew Trick
888ff1ae99 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 46a9f57329.

This broke Swift CI, OSS incremental RA:

./swift/stdlib/public/SDK/Foundation/TimeZone.swift:228:45: error: 'NSTimeZone' is not implicitly convertible to 'TimeZone'; did you mean to use 'as' to explicitly convert?
        return lhs._wrapped.isEqual(to: rhs._wrapped)
2016-07-16 18:34:32 -07:00
Tony Parker
46a9f57329 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 17:58:27 -07:00
Andrew Trick
7b5723b9a5 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 9c1f21bdf0.

This breaks swift-ci for everyone:

stdlib/public/SDK/Foundation/Calendar.swift:426:74: error: 'DateInterval' is only available on iOS 10.0 or newer
    public func dateInterval(of component: Component, for date: Date) -> DateInterval? {
2016-07-16 17:08:06 -07:00
Tony Parker
9c1f21bdf0 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 15:48:08 -07:00
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -07:00
Chris Willmore
73d5077bae Add API notes for Foundation following internal Swift 3 naming audit. 2016-04-07 20:35:18 -07:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Doug Gregor
06c5e9cd5b 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.
2015-12-11 14:46:50 -08: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
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
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
Maxwell Swadling
661fde2ca6 [stdlib] removed ambiguous String comparison overloads
Fixes rdar://problem/19169066

Now that some implicit bridging conversions were removed, we can remove some of
the complex String comparison overloads. We could not remove all of them yet, as
String to NSString implicit bridging still exists. To work around this,
unavailable annotations were used. This ensures the user always gets the String
comparison function they intended.

Swift SVN r24536
2015-01-19 23:18:07 +00:00
Chris Willmore
68dd563fbf <rdar://problem/18311362> TLF: Eliminate implicit bridging conversions
Require 'as' when converting from Objective-C type to native type (but
continue to allow implicit conversion from native to Objective-C). This
conversion constraint is called ExplicitConversion; all implicit
conversions are covered by the existing Conversion constraint. Update
standard library and tests to match.

Swift SVN r24496
2015-01-18 00:07:45 +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
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
c519ecfe4f API Notes File: The product of the 2d nullability audit of Foundation.
As well as the required test/stdlib modifications.

Swift SVN r21181
2014-08-13 19:39:59 +00:00
Anna Zaks
ca03e527c3 API Notes File: Add the notes generated as the product of the first nullability audit of Foundation
As well as the required test modifications.

Swift SVN r21126
2014-08-09 01:40:48 +00:00
Dave Abrahams
a3211d0d68 [stdlib] dynamic NSString.localizedStringWithFormat
It used to always construct an NSString; now it constructs the class it
was called through

Swift SVN r20439
2014-07-23 22:59:27 +00:00
Dmitri Hrybenko
766c9816de stdlib: underscore-prefix String.core
Swift SVN r20411
2014-07-23 16:28:57 +00:00
Doug Gregor
ed54826e1c Replace the implicit NSRange -> Range<Int> conversion with a toRange method
Swift SVN r19692
2014-07-08 20:05:09 +00:00
Doug Gregor
67ca1c9ea1 Implement the new casting syntaxes "as" and "as?".
There's a bit of a reshuffle of the ExplicitCastExpr subclasses:
  - The existing ConditionalCheckedCastExpr expression node now represents
"as?". 
  - A new ForcedCheckedCastExpr node represents "as" when it is a
  downcast.
  - CoerceExpr represents "as" when it is a coercion.
  - A new UnresolvedCheckedCastExpr node describes "as" before it has
  been type-checked down to ForcedCheckedCastExpr or CoerceExpr. This
  wasn't a strictly necessary change, but it helps us detangle what's
  going on.

There are a few new diagnostics to help users avoid getting bitten by
as/as? mistakes:
  - Custom errors when a forced downcast (as) is used as the operand
  of postfix '!' or '?', with Fix-Its to remove the '!' or make the
  downcast conditional (with as?), respectively.
  - A warning when a forced downcast is injected into an optional,
  with a suggestion to use a conditional downcast.
  - A new error when the postfix '!' is used for a contextual
  downcast, with a Fix-It to replace it with "as T" with the
  contextual type T.

Lots of test updates, none of which felt like regressions. The new
tests are in test/expr/cast/optionals.swift. 

Addresses <rdar://problem/17000058>


Swift SVN r18556
2014-05-22 06:15:29 +00:00
Joe Pamer
5d95457efc Disallow operator overloads that require implicit conversions for all arguments (rdar://problem/16785445)
Swift SVN r18019
2014-05-13 20:09:50 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
7406986487 SILGen: Class constructors need to return modified self.
-[NSMutableArray init] modifies self, causing NSStringDemo to fail when sil-irgenned because SILGen didn't handle constructors changing 'this' correctly.

Swift SVN r4728
2013-04-13 19:21:10 +00:00