Commit Graph

12522 Commits

Author SHA1 Message Date
Slava Pestov
bcdc9e7c50 Merge pull request #22237 from slavapestov/type-reconstruction-part-3
Type reconstruction rework, part 3
2019-01-30 10:49:18 -05:00
John McCall
8be4ec32e6 Protocol requirement overrides must match in mutating-ness.
Without this change, SILGen will crash when compiling a use of the
derived protocol's requirement: it will instead attempt to use
the base protocol's requirement, but the code will have been
type-checked incorrectly for that.

This has a potential for source-compatibility impact if anyone's
using explicit override checking for their protocol requirements:
reasonable idioms like overriding a mutating requirement with a
non-mutating one will no longer count as an override.  However,
this is arguably a bug-fix, because the current designed intent
of protocol override checking is to not allow any differences in
type, even "covariant" changes like making a mutating requirement
non-mutating.  Moreover, we believe explicit override checking in
protocols is quite uncommon, so the overall compatibility impact
will be low.

This also has a potential for ABI impact whenever something that
was once an override becomes a non-override and thus requires a
new entry.  It might require a contrived test case to demonstrate
that while using the derived entry, but it's quite possible to
imagine a situation where the derived entry is not used directly
but nonetheless has ABI impact.

Furthermore, as part of developing this patch (earlier versions of
which used stricter rules in places), I discovered a number of
places where the standard library was unintentionally introducing
a new requirement in a derived protocol when it intended only to
guide associated type deduction.  Fixing that (as I have in this
patch) *definitely* has ABI impact.
2019-01-30 01:33:09 -05:00
Slava Pestov
36d3f47388 ASTDemangler: Preserve generic arguments for bound generic Objective-C classes
MetadataLookup gives special treatment to imported Objective-C classes,
since there's no nominal type descriptor and metadata is obtained
directly by calling into the Objective-C runtime.

Remote reflection also gives special treatment to imported Objective-C
classes; they don't have field descriptors.

However, the ASTDemangler needs to treat them like ordinary classes,
in particular it wants to preserve the generic arguments here so that
we can round-trip debug info.
2019-01-30 01:28:48 -05:00
Slava Pestov
d29b545870 Merge pull request #22185 from slavapestov/type-reconstruction-part-2
Type reconstruction rework, part 2
2019-01-30 00:13:01 -05:00
Slava Pestov
4a74bf4ba1 ASTDemangler: Add support for lowered function types 2019-01-29 21:55:57 -05:00
swift-ci
eb44285914 Merge pull request #22233 from DougGregor/foundation-error-bridging-info-rename 2019-01-29 18:15:49 -08:00
Doug Gregor
30a6c0fac1 [Foundation] Rename swift_errorBridgingInfo so it doesn't conflict with pre-stable ABI Swift
Fixes rdar://problem/47651565
2019-01-29 17:22:31 -08:00
Maxim Moiseev
d00307202b Uncomment 'obsoleted: 5.0' on a flatMap variant 2019-01-29 16:26:46 -08:00
Slava Pestov
13a50c2d2d ASTDemangler: Add support for lowered metatypes 2019-01-29 19:15:17 -05:00
Slava Pestov
fce933910d ASTDemangler: Implement types in generic local context
If we nest a type inside a local context inside a generic type,
we have to look through the local context(s) to find the outer
generic type when stripping off generic arguments.

We don't support nominal types inside generic local context
right now, but this can happen with type aliases.
2019-01-29 19:15:17 -05:00
Maxim Moiseev
02cc2256e9 [stdlib] Remove a bunch of declarations marked as obsoleted in 4 2019-01-29 11:13:47 -08:00
Michael Munday
6ab83122ac Fix storeEnumTagSinglePayload on big-endian systems
The part of the tag stored in the payload can currently be up to
8 bytes in size (though only the 'low' 4 bytes can be non-zero).
On little-endian machines this doesn't matter, we can always just
store up to 4 bytes and zero the remaining payload bytes. On big-
endian systems however we may need to store more than 4 bytes.

The store implementation now mirrors the runtime code that fetches
the tag on big-endian systems which already treats the payload tag
as an 8 byte integer.

This is a spot fix but longer term we might want to consider
refactoring this code to reduce the number of differences between
big- and little-endian implementations. For example, we could
centralise some of the copying logic and/or make the payload tag
a 4 byte field on all platforms.
2019-01-29 08:11:04 -05:00
Saleem Abdulrasool
85f45dfe30 SwiftRemoteMirror: add a host build for the tools
This adds an explicit version of the SwiftRemoteMirror library for use
in the tools that comprise the toolchain.  This is a separate build from
the target specific builds of the library even though we may be building
the runtime for the (same) host.
2019-01-28 18:00:58 -08:00
Saleem Abdulrasool
18a59bc7a0 Merge pull request #22153 from compnerd/winsdk
WinSDK: extend the module definition for Foundation
2019-01-28 12:38:59 -08:00
swift-ci
8458f10a40 Merge pull request #22150 from DougGregor/remote-ast-extensions 2019-01-28 09:05:45 -08:00
Doug Gregor
2a3b237a82 [swift-reflection-test] Strings read here are not always valid UTF-8.
The “string length” primitive was validating the string data as valid UTF-8
to get the length. However, mangled names, which get read by this operation,
are not always valid UTF-8. Just count the bytes until a ‘0’ and don’t
validate.
2019-01-27 22:03:37 -08:00
Saleem Abdulrasool
c1da7a206a WinSDK: extend the module definition for Foundation
Update the module definition to extend it to support stack symbolication
for use in Foundation.
2019-01-26 10:52:10 -08:00
Arnold Schwaighofer
bcc7588db9 Merge pull request #22125 from aschwaighofer/workaround_dynamic_replacement_failure
DynamicReplacement: Don't fail when a library is closed and reloaded
2019-01-26 07:57:06 -08:00
Slava Pestov
b6951932b4 ASTDemangler: Implement type alias types
Debug info uses a special mangling where type aliases can be
represented without being desugared; attempt to reconstruct
the TypeAliasType in this case.
2019-01-25 21:59:48 -05:00
Ravi Kandhadai
ee222c3fdf [Constant Evaluator] Add support for string appends and equals to
the constant evaluator.
2019-01-25 18:51:33 -08:00
Slava Pestov
55605ceab9 ASTDemangler: Implement DynamicSelfType 2019-01-25 21:44:02 -05:00
Slava Pestov
bbe6a56e22 ASTDemangler: Implement builtin types 2019-01-25 21:44:02 -05:00
Slava Pestov
2d21233378 ASTDemangler: Implement unresolved DependentMemberType
The debug mangling emits these when the type parameter only
conforms to one protocol having an associated type with this
name.
2019-01-25 21:44:02 -05:00
Saleem Abdulrasool
72f0efe76e Merge pull request #22027 from linux-on-ibm-z/master_s390x_string_comparison
fixed small String comparison for big_endian
2019-01-25 18:32:03 -08:00
Arnold Schwaighofer
8394fc525e DynamicReplacement: Don't fail when a library is closed and reloaded
rdar://47560273
2019-01-25 13:50:27 -08:00
Ben Cohen
80f0a697fc Remove a couple of obsoleted-in-4.0 methods 2019-01-25 13:33:21 -08:00
Jordan Rose
bad30a5313 [CMake] Remove logic to set unused macro __SWIFT_CURRENT_DYLIB (#22105)
Once upon a time we tried to use this to limit the visibility of
symbols in the Swift runtime in a way that didn't really make sense.
Dave Z removed it last year in 91823273d2.

No functionality change.
2019-01-24 20:15:29 -08:00
Stephen Canon
3501568fc0 Make SIMD types Codable. (#22092)
* Make SIMD types codable. We're considering this a bugfix.

This is a very tiny ABI change, in that user-defined SIMD types compiled with an earlier version of 5.0 will be missing the necessary conformance to Codable. Discussed with Ben, and we're OK with this because we don't think there are such types yet, and it can be fixed with a recompile.

* Add basic tests
2019-01-24 23:08:29 -05:00
swift-ci
92416e753d Merge pull request #22066 from ravikandhadai/master 2019-01-24 13:39:35 -08:00
Saleem Abdulrasool
7efd6df09d build: remove some unused variables in CMake (NFC)
`swift_platform_flags` and `swift_platform_name` are no longer used.  Remove
them.
2019-01-24 08:25:36 -08:00
Ravi Kandhadai
a0277e2010 [stdlib] Fixing a buggy example in the comments in the file UnsafeRawPointer.swift 2019-01-23 13:08:47 -08:00
Xiaodi Wu
870dae5204 [docs] hasPrefix and hasSuffix don't match scalars (#22056) 2019-01-23 10:21:55 -06:00
Michael Ilseman
81e87ac838 Merge pull request #21959 from milseman/fast_foundation
[String] Add UTF-8 fast-paths for Foundation initializers
2019-01-22 16:26:36 -08:00
Michael Ilseman
3df92911f9 [String] Speed up ASCII checking.
Perform ASCII checking using pointer-width strides, making sure to
align properly.
2019-01-22 15:06:03 -08:00
Scott Perry
df3a058a6f s/shortestEditScript/difference/g per proposal feedback 2019-01-21 22:31:04 -08:00
samding01
197c9634b4 fixed small String comparsion for big_endian 2019-01-21 19:09:07 +00:00
Ben Cohen
4363f61dec Mark ClosedRange->Range conversion inlinable 2019-01-18 17:27:27 -08:00
Mike Ash
ae0f04ab23 Merge pull request #21958 from mikeash/rename-avoid-more-objc-conflicts
[stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
2019-01-18 17:18:03 -05:00
Slava Pestov
5e2e467b05 Merge pull request #21631 from Azoy/something-something-string-storage
[stdlib] NFC: Simplify _getCString
2019-01-18 13:28:36 -05:00
Max Moiseev
fce2c19c0c Merge pull request #21939 from ebainville/compression-overlay
InputFilter, OutputFilter overlay for the Darwin Compression stream API
2019-01-17 19:14:05 -08:00
Maxim Moiseev
18f4ffeeb3 Change doc comment style 2019-01-17 15:21:31 -08:00
Maxim Moiseev
d3f3890cc3 Make Compression.Algorithm conform to CaseIterable 2019-01-17 15:06:03 -08:00
Saleem Abdulrasool
7bb6185bbf Shims: make the __swift_ssize_t handling more portable
Unfortunately, `cl` does not support C11.  Guard the `_Generic` approach and in
C++ mode use `std::make_signed`.  Thanks to Jordan Rose for the reminder about
the type_traits helper!
2019-01-17 14:53:42 -08:00
Michael Ilseman
a088e13224 [String] Add UTF-8 fast-paths for Foundation initializers
Many Foundation initializers could benefit from faster string
construction and subsequent reads in Swift 5. Add UTF-8 fast paths for
when constructing a string from a valid UTF-8 code units.
2019-01-17 14:15:40 -08:00
Mike Ash
faceaaa0ab [stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
JSONEcoder/Decoder get another underscore in their ObjC name, as the one with a single underscore conflicts with older Swifts that had _JSONEcoder/Decoder as internal rather than fileprivate.

_JSONEncoder/Decoder get another underscore in their Swift name to avoid conflicting with the ObjC name from the ones in older overlays.
2019-01-17 17:12:01 -05:00
Eric Bainville
a05ecf9c53 fixes from code review 2019-01-17 13:09:56 -08:00
Maxim Moiseev
3e05648996 Stylistic changes 2019-01-17 11:10:49 -08:00
Max Moiseev
a2659f0b33 Update stdlib/public/Darwin/Compression/Compression.swift
Co-Authored-By: ebainville <ebainville@apple.com>
2019-01-17 09:05:43 -08:00
Eric Bainville
556f79d8d0 InputFilter, OutputFilter overlay for the Darwin Compression stream API, and corresponding test 2019-01-16 14:41:06 -08:00
Ben Cohen
eb083ce84d Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage" (#21874)
* Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage"
2019-01-16 10:22:58 -08:00