Commit Graph

2342 Commits

Author SHA1 Message Date
Xiaodi Wu
e7da51e000 Adjust floating-point nextUp test for NaN on ARM 2018-03-09 15:23:27 -06:00
Erik Eckstein
d5b8c89cff tests: disable a floating point test for arm 2018-03-09 11:09:57 -08:00
Robert Widmann
72e4224dc9 Merge pull request #13655 from CodaFi/ace-attorney
[SE-0194] Implement deriving collections of enum cases
2018-03-09 12:43:13 -05:00
Slava Pestov
9aa4cd6680 os: Fix os_log() handling of '%.*P'
- When a count was part of the format string, we looked at the
  wrong character when forming the count.

- The OSLF_CMD_TYPE_DATA command type expects a pointer preceded
  by a OSLF_CMD_TYPE_COUNT command, not 'count' bytes inline.

Fixes <rdar://problem/38080623>.
2018-03-08 23:10:42 -08:00
Robert Widmann
dac06898e9 [SE-0194] Deriving Collections of Enum Cases
Implements the minimum specified by the SE-proposal.

* Add the CaseIterable protocol with AllCases associatedtype and
allCases requirement
* Automatic synthesis occurs for "simple" enums
    - Caveat: Availability attributes suppress synthesis.  This can be
              lifted in the future
    - Caveat: Conformance must be stated on the original type
              declaration (just like synthesizing Equatable/Hashable)
    - Caveat: Synthesis generates an [T].  A more efficient collection
              - possibly even a lazy one - should be put here.
2018-03-09 00:22:55 -05:00
Erik Eckstein
2da8a2dece tests: re-enable test/Interpreter/protocol_initializers.swift for linux
And update Jira link for test/stdlib/ErrorHandling.swift
2018-03-08 10:37:27 -07:00
swift-ci
8ff5fba0b9 Merge pull request #15062 from eeckstein/disable-tests 2018-03-07 17:09:10 -08:00
Erik Eckstein
6cf75f592f tests: disable 2 tests on linux which fail in optimized mode.
Until we fix this, I'd like to enable optimized mode testing on linux
2018-03-07 17:28:38 -07:00
Xiaodi Wu
458ab92cf4 Merge pull request #15051 from xwu/adjust-fp-nextup-test
[stdlib] Adjust floating-point nextUp test for NaN
2018-03-07 18:16:14 -06:00
Jordan Rose
e202e90294 Clean up _BridgedNSError and _BridgedStoredNSError (#14682)
Despite their similar names and uses, these protocols no longer share
much functionality - the former is used to take @objc enums defined in
Swift that conform to Error and expose them as NSErrors, and the
latter handles NS_ERROR_ENUM C enums, which get imported into Swift as
a wrapper around NSError. We can actually simplify them quite a bit.

- Eliminate base protocol __BridgedNSError, which no longer provides
  any implementation for _BridgedStoredNSError.

- Eliminate default implementations that match what the compiler would
  synthesize.

- Adopt recursive constraints and where-clauses on associated types
  (and update the Clang importer to handle this).

- Collapse signed and unsigned default implementations when reasonable.

- Fold _BridgedStoredNSError's _nsErrorDomain into the existing public
  requirement CustomNSError.errorDomain.

rdar://problem/35230080
2018-03-07 13:14:36 -08:00
Xiaodi Wu
ba186c366e Adjust floating-point nextUp test for NaN 2018-03-07 13:36:17 -06:00
Karoy Lorentey
b52a94d789 [test] Fix tests relying on specific hash values or Set/Dictionary orderings
We shouldn't need to update regular tests if/when we modify the hash function.
2018-03-07 16:44:43 +00:00
Saleem Abdulrasool
b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
This converts the instances of the pattern for which we have a proper
substitution in lit.  This will make it easier to replace it
appropriately with Windows equivalents.
2018-03-06 14:30:54 -08:00
UENO Kenichi
63aed1d782 [Test] Rewrite let _ with _ 2018-03-03 12:57:44 +09:00
UENO Kenichi
7005fbb870 [Test] Replace unused variable with _ 2018-03-03 11:55:59 +09:00
Max Moiseev
7675e12e49 Merge pull request #14859 from moiseev/filter-filter-compat
[stdlib] Source compatibility fix for lazy filter-filter and map-map cases
2018-02-27 14:31:00 -08:00
Philippe Hausler
26d4ea18b2 [Foundation] searching in slices should index relative to the slice (#14851) 2018-02-27 14:00:32 -08:00
Max Moiseev
661f56d1c3 [stdlib] Source compatibility fix for lazy filter-filter and map-map cases
In order to maintain source compatibility the type-folding behavior
should not be the default in Swift 3 and Swift 4 modes.
2018-02-27 11:26:46 -08:00
Joe Groff
4c2dde56a0 IRGen: Lower external key path components.
The key path pattern needs to include a reference to the external descriptor, along with hooks for lowering its type arguments and indices, if any. The runtime will need to instantiate and interpolate the external component when the key path object is instantiated.

While we're here, let's also reserve some more component header bytes for future expansion, since this is an ABI we're going to be living with for a while.
2018-02-23 19:03:15 -08:00
Mike Ash
03476e919e Merge branch 'master' into remove-reflectionlegacy 2018-02-22 11:44:55 -05:00
Pavel Yaskevich
c8e37242fe Merge pull request #13926 from xedin/rdar-26060144
[Runtime/ABI] Replace `emitTypeFieldAccessor` with a single runtime method
2018-02-21 10:50:02 -08:00
Pavel Yaskevich
7a7825ff50 [Runtime/Reflection] Switch enum mirrors to use runtime get field method 2018-02-20 18:20:09 -08:00
Max Moiseev
bfddc4a763 [stdlib] Make default implementations of bitwise operators as obsoleted
Fixes: https://bugs.swift.org/browse/SR-7019

Prior to Swift 4 and the new integers, there was a protocol called
`BitwiseOperations`. It was deemed not needed with the introduction of
the integer protocols. But, for backward compatibility, it was left in
the standard library as `_BitwiseOperations` with a conditionally
available typealias `BitwiseOperations`. That protocol declares only the
"non-muating" operators, the mutating ones (i.e. `|=` and friends) are
defined as free functions. They are implemented in terms of
`_BitwiseOperations` protocol requirements, which is reasonable.

In the new integer protocols we established a
convention to provide default implementations for non-mutating functions
in terms of mutating ones (exactly the opposite of a much earlier
decision made for `BitwiseOperations`). So now, when you define a type
that conforms to the `FixedWidthInteger`, even though both mutating and
non-mutating bitwise operations are required, the default implementation
of `|` comes from extension FixedWidthInteger, and the default
implementation of `|=` comes from the _BitwiseOperations free functions.
And they are mutually recursive. Hence the crash.

This commit breaks the recursion by marking default implementations for
`|` etc. in `_BitwiseOperations` obsoleted from Swift 4.1 onward. The
test is also added to make sure the change helps.
2018-02-20 16:31:20 -08:00
Mike Ash
fa2ea034d1 Merge branch 'master' into remove-reflectionlegacy 2018-02-19 09:56:57 -05:00
Lance Parker
0661de22a2 [stdlib]Un-revert string comparison (#14694)
Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
2018-02-18 10:50:33 -08:00
Mike Ash
4045edf886 [Runtime] Remove old-style mirrors in ReflectionLegacy.swift.
The old-style mirrors were the basis for non-custom, reflection based Mirrors. As part of removing old-style mirrors, reflection based Mirrors are reimplemented without them. Reflection.mm is deleted and replaced with ReflectionMirror.mm, which borrows a chunk of the old code but presents a simpler API to the Swift side. ReflectionMirror.swift then uses that API to implement a reflection-based Mirror init.

rdar://problem/20356017
2018-02-16 16:05:40 -05:00
Lance Parker
abe6a6d177 Revert string comparison (#14657) 2018-02-15 14:37:43 -08:00
Pavel Yaskevich
33996de39c Merge pull request #14649 from xedin/objc-existential-type-by-name
[Runtime] Existential types marked as @objc should satisfy class requirement
2018-02-14 22:28:37 -08:00
Pavel Yaskevich
73f09ecbf5 [Runtime] Existential types marked as @objc should satisfy class requirement
Make sure that `checkGenericRequirements` properly enforces
"class requirement" constraint on the generic parameters.
2018-02-14 21:16:44 -08:00
Lance Parker
49bc1459ae Update string comparison tests 2018-02-14 15:44:11 -08:00
Max Moiseev
b6bbe31c4d Merge pull request #14605 from moiseev/flatmap-versioned-deprecation
[stdlib] Only deprecate flatMap starting with Swift 4.1
2018-02-14 11:30:17 -08:00
Max Moiseev
2670874072 [stdlib] Only deprecate flatMap starting with Swift 4.1
Fixes: https://bugs.swift.org/browse/SR-6970 and rdar://problem/37393816
2018-02-13 13:47:58 -08:00
Mark Lacey
dc8c88058f Fix an issue with the constraint favoring code in the constraint optimizer.
The code was favoring overloads where *either* argument matched its
parameter type and where both parameter types were the same. This
is really overly broad and can result in bugs like the one here, where
we only attempt the
  (Int, Int) -> Bool
overload of '!=' despite the fact that it means forcing an
optional. We should select the
  <T>(T?, T?) -> Bool
overload instead, and inject the non-optional operand into an optional.

Making this require *both* arguments to match mostly disables this
optimization, though, since for somethin like "a"+"b"+"c" the second
add has a type variable and string literal as arugments.

So instead, we'll just disable this in cases where one argument is the
optional of the other, to ensure we never try forcing one side. This
also means we'll disable the optimization in cases where we would
inject one operand into an optional, but that's likely find as we
don't have long chains of expressions where that happens.

Fixes rdar://problem/37073401.
2018-02-13 10:24:30 -08:00
Xiaodi Wu
09f77ff58d Merge pull request #14361 from xwu/less-miscellany
[stdlib] Remove outdated miscellaneous functions
2018-02-06 19:49:56 -06:00
Ben Cohen
415d90c72c Move collection compat test that needs StdlibCollectionUnittest to validation-test 2018-02-05 13:19:41 -08:00
Mark Lacey
2008674495 Make ImplicitlyUnwrappedOptional<T> an unavailable typealias.
Also remove the decl from the known decls and remove a
bunch of code referencing that decl as well as a bunch of other
random things including deserialization support.

This includes removing some specialized diagnostics code that
matched the identifier ImplicitlyUnwrappedOptional, and tweaking
diagnostics for various modes and various issues.

Fixes most of rdar://problem/37121121, among other things.
2018-02-02 08:35:53 -08:00
Xiaodi Wu
d7ab0aab20 Remove tests for obsolete miscellany 2018-02-02 10:02:07 -06:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Ben Cohen
c1d4b60281 [stdlib] Collection compatibility shim fixes (#14342)
* Fix compatibility shims for IndexDistance

* Add a second test for implied IndexDistance, Bidirectional conformance
2018-02-01 19:47:11 -08:00
Lance Parker
37807731a1 test additive mutations too 2018-01-31 17:20:56 -08:00
Lance Parker
084c46c5e0 Test 2018-01-31 16:54:34 -08:00
Vedant Kumar
20f95f9250 [DebuggerSupport] Test formatting of the small and Cocoa variants
This test case has been lifted from test/stdlib/NewString.swift.
2018-01-30 18:29:35 -08:00
swift-ci
b28c282f09 Merge pull request #14219 from xwu/nunc-est-dividendum 2018-01-30 17:56:50 -08:00
Joe Groff
fdef6ef15f Merge pull request #13468 from jckarter/generic-requirement-details
Context descriptors
2018-01-30 06:49:16 -08:00
swift-ci
238b876602 Merge pull request #14251 from vedantk/pretty-print 2018-01-29 18:36:24 -08:00
Vedant Kumar
7fe43d6d71 Mark a debugger support test as requiring objc_interop 2018-01-29 17:36:46 -08:00
Joe Groff
a7a3b17597 Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while
more accurately encoding important information about nested generic
contexts with same-type and layout constraints that need to be evaluated
at runtime. It's also designed with an eye to forward- and
backward-compatible expansion for ABI stability with future Swift
versions.
2018-01-29 16:19:25 -08:00
Vedant Kumar
5049db0dd9 [DebuggerSupport] Attempt expanding objects with .class display style
When pretty-printing objects, attempt to expand & print objects which
have the `.class` display style even if they do not have any instance
variables. The pretty-printer will still bail out if the object does not
conform to CustomReflectable.

This is enough to teach the pretty-printer to format bridged NSStrings.

rdar://36843869
2018-01-29 15:31:53 -08:00
Mike Ash
5e2b11d42d Merge pull request #14157 from mikeash/conditionally-disable-runtimefunctioncounters
[Runtime] Remove RuntimeFunctionCounters in no-assert builds.
2018-01-29 15:48:32 -05:00
Xiaodi Wu
cc0e64dec4 Implement efficient DoubleWidth division and fix division-related bugs 2018-01-28 14:01:06 -06:00