Commit Graph

48 Commits

Author SHA1 Message Date
Ben Langmuir
a2ee20d490 [test] Fix stdlib/RuntimeObjC.swift with newer deployment target
This test stops working with deployment targets that no longer link
@rpath/libswiftCoreGraphics.dylib when running on OSes that still
require the CoreGraphics overlay. Explicitly link it to workaround.

rdar://135451615
2024-09-09 15:03:01 -07:00
Allan Shortlidge
1e9a2bc4c9 Tests: Update stdlib/RuntimeObjC.swift to always link libswiftCoreGraphics.
The core definitions of CGPoint and other types were pushed down from
CoreGraphics to CoreFoundation. This test indirectly depends on the conformance
of those types to CustomReflectable, but nothing in the test was using those
conformances explicitly and so libswiftCoreGraphics would not be auto-linked
when the test is compiled at a high enough deployment target. Use the
conformances directly to force linkage.

Resolves rdar://121343931
2024-01-23 16:59:13 -08:00
Alexis Laferrière
32abd32ab3 [Test] Disable deserialization safety in test breaking access control 2023-01-11 15:11:11 -08:00
Anthony Latsis
52ce15ee9d Gardening: Migrate test suite to GH issues: stdlib 2022-09-22 03:21:39 +03:00
Anthony Latsis
3615aa1106 Add regression test to close #43154 2022-07-05 19:29:07 +03:00
Anthony Latsis
7732306fa9 Add regression test to close #43135 2022-06-25 00:48:02 +03:00
Josh Soref
624a54b9cf Spelling stdlib (#42544)
* spelling: abcdefghijklmnopqrstuvwxyz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: collection

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compressible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constituent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contiguous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: convertibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: element

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: enforce

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exhaustive

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exhausts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: facilitate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ignored

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: incorporated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intersection

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: laziness

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: misaligned

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overhaul

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preamble

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: precondition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replacement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trailing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unambiguous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uncompressible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: world

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-22 19:18:38 -07:00
Arnold Schwaighofer
b31b7a9d8e Remove some UNSUPPORTED swift_test_mode_optimize_none_with_implicit_dynamic
rdar://51228899
2019-05-31 08:45:37 -07:00
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Erik Eckstein
cc35f385ed Runtime: fix mangling of nested private generic classes
The generated mangled names were wrong and couldn't be demangled.
For example the runtime generated class name for PrivateGeneric was wrong:

class OuterClass {
    private class PrivateGeneric<T, U> { }
}

rdar://problem/47529629
2019-01-25 16:49:08 -08:00
Doug Gregor
17699d4e33 [Metadata] Emit complete context descriptors for parents of anonymous contexts
When a (file)private entity occurs inside a generic context, we still need
information about the genericity of the enclosing context to demangle
to metadata. Emit complete context descriptors for parents of anonymous
contexts.

Fixes rdar://problem/46109026.
2018-11-16 21:34:32 -08:00
Michael Ilseman
53ee971dbc [test] Update test to reflect DCE 2018-11-04 10:42:42 -08:00
Doug Gregor
d73a2e0d39 [Runtime] Properly form generic arguments for metadata-to-demangle-tree.
When mapping from type metadata to a demangle tree, fill in the complete
set of generic arguments. Most of the effort here is in dealing with
extensions that involve same-type constraints on a generic parameter, e.g.,

  extension Array where String == Element { }
  extension Dictionary where Key == Value { }

In such cases, the metadata won’t contain generic arguments for every
generic parameter. Rather, the generic arguments for non-key generic
parameters will need to be computed based on the same-type requirements
of the context. Do so, and eliminate the old hacks that put the generic
arguments on the innermost type. We don’t need them any more.

Part of rdar://problem/37170296.
2018-09-25 23:10:08 -07:00
Arnold Schwaighofer
2d8a1dbbfe Codesign test/stdlib 2018-08-10 06:58:40 -07:00
Robert Widmann
1aca4d141d Migrate some stdlib tests to swift 4 2018-06-27 12:38:52 -07:00
Slava Pestov
5d2752f7d2 Run tests with -swift-version 4 by default
Some test now fail, so add an explicit -swift-version 3.
2018-06-19 23:24:19 -07:00
Joe Groff
6349dea762 Regression test for https://bugs.swift.org/browse/SR-7357 2018-04-10 14:22:04 -07:00
Lance Parker
cbf157f924 [stdlib]Unify String hashing implementation (#14921)
* Add partial range subscripts to _UnmanagedOpaqueString

* Use SipHash13+_NormalizedCodeUnitIterator for String hashes on all platforms

* Remove unecessary collation algorithm shims

* Pass the buffer to the SipHasher for ASCII

* Hash the ascii parts of UTF16 strings the same way we hash pure ascii strings

* De-dupe some code that can be shared between _UnmanagedOpaqueString and _UnmanagedString<UInt16>

* ASCII strings now hash consistently for in hashASCII() and hashUTF16()

* Fix zalgo comparison regression

* Use hasher

* Fix crash when appending to an empty _FixedArray

* Compact ASCII characters into a single UInt64 for hashing

* String: Switch to _hash(into:)-based hashing

This should speed up String hashing quite a bit, as doing it through hashValue involves two rounds of SipHash nested in each other.

* Remove obsolete workaround for ARC traffic

* Ditch _FixedArray<UInt8> in favor of _UIntBuffer<UInt64, UInt8>

* Bad rebase remnants

* Fix failing benchmarks

* michael's feedback

* clarify the comment about nul-terminated string hashes
2018-03-17 22:13:37 -07:00
Ben Cohen
f9b3e14137 [stdlib] Use Swift-native Character iteration for hasPrefix/Suffix (#14390)
* Use Swift-native Character iteration for hasPrefix/Suffix

* Remove old tests for removed C shims
2018-03-12 17:41:55 -07: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
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
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
Jordan Rose
59b5e2ec0d Mangle an anonymous C enum using its enclosing typedef, like C++ does
Without this, we would fall back to a Swift name even for C types that
we can expect to have stable names for linkage purposes.
2018-01-10 15:38:07 -08:00
Jordan Rose
38e2cfe1e2 Mangle imported declarations using their C names.
This makes them consistent no matter what shenanigans are pulled by
the importer, particularly NS_ENUM vs. NS_OPTIONS and NS_SWIFT_NAME.

The 'NSErrorDomain' API note /nearly/ works with this, but the
synthesized error struct is still mangled as a Swift declaration,
which means it's not rename-stable. See follow-up commits.

The main place where this still falls down is NS_STRING_ENUM: when
this is applied, a typedef is imported as a unique struct, but without
it it's just a typealias for the underlying type. There's also still a
problem with synthesized conformances, which have a module mangled
into the witness table symbol even though that symbol is linkonce_odr.

rdar://problem/31616162
2018-01-09 17:55:24 -08:00
Jordan Rose
18689fe223 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2018-01-09 17:55:23 -08:00
Joe Shajrawi
66d0df6bae Revert "Temporary disable failing armv7 tests"
This reverts commit 78e5e25215.
2017-08-15 13:43:57 -07:00
Joe Shajrawi
78e5e25215 Temporary disable failing armv7 tests 2017-08-08 15:22:14 -07:00
Mishal Shah
c5ff1f2cac Update master to build with Xcode 9 beta 1, OS X 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-06-14 16:20:35 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Erik Eckstein
dfa6582df6 runtime: make the objc runtime mangling of AnyObject compatible to the swift 3 mangling 2017-05-08 17:58:43 -07:00
Erik Eckstein
07cc2831df runtime: Add support for objc runtime mangling of ProtocolListWithClass and ProtocolListWithAnyObject nodes 2017-05-08 11:35:08 -07:00
Jordan Rose
c8d3506e55 Revert "[Mangling] Uniformly use "So" for imported decls." (#9233)
This reverts commit 25985cb764. For now,
we're trying to avoid spurious non-structural changes to the mangling,
so that the /old/ mangling doesn't appear to change. That doesn't mean
no changes at all, but we can save this one for later.
2017-05-03 16:13:29 -07:00
Erik Eckstein
c4002a9398 Use the old mangling for generic ObjC runtime names, which are generated at runtime.
To be backward compatible to existing archives created by the NSKeyedArchiver for generic classes
2017-05-03 10:52:54 -07:00
Jordan Rose
25985cb764 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2017-04-24 09:57:30 -07:00
Erik Eckstein
fcd79c044d Mangling: consider bound generic types for substitutions
This shrinks the name length if the same bound generic type is used multiple times, like: func foo(_ x: [Int], _ y: [Int])
2017-03-05 17:40:07 -08:00
Erik Eckstein
d4b256cd8f Use new mangling for protocol names in protocol descriptors 2017-02-22 16:00:20 -08:00
Erik Eckstein
2d127e4192 Reinstate ”Use the new mangling for reflection."
It also uses the new mangling for type names in meta-data (except for top-level non-generic classes).
lldb has now support for new mangled metadata type names.

This reinstates commit 21ba292943.
2017-02-15 09:47:22 -08:00
Erik Eckstein
254f36aba5 Revert "Use the new mangling for reflection."
This needs some changes in lldb.
Disabled for now until lldb supports the new mangling.

This reverts commit 21ba292943.
2017-02-08 09:01:51 -08:00
Erik Eckstein
21ba292943 Use the new mangling for reflection.
For this we are linking the new re-mangler instead of the old one into the swift runtime library.
Also we are linking the new de-mangling into the swift runtime library.

It also switches to the new mangling for class names of generic swift classes in the metadata.
Note that for non-generic class we still have to use the old mangling, because the ObjC runtime in the OS depends on it (it de-mangles the class names).
But names of generic classes are not handled by the ObjC runtime anyway, so there should be no problem to change the mangling for those.
The reason for this change is that it avoids linking the old re-mangler into the runtime library.
2017-02-07 08:36:21 -08:00
Joe Groff
ecfa78a3cc Runtime: Look through artificial ObjC subclasses when building demangle trees for classes.
Fixes rdar://problem/29962114, a regression in presenting the stringified names of ObjC classes that have been dynamically subclassed by KVO.
2017-01-11 20:12:16 -08:00
Slava Pestov
4e4d281aa7 stdlib: Rework swift_typeName() to use _swift_buildDemanglingForMetadata()
Previously we had two separate mechanisms to turn a metatype
into a string. The swift_typeName() function was used to print
the metatype in a human-readable fashion, whereas the
_swift_buildDemanglingForMetadata() was used when naming
generated generic Objective-C classes.

Unify them, since what swift_typeName() does is redundant;
instead of going directly from the metatype to a human-readable
string, we can get the mangling, and print that using the
demangler.

This fixes some issues with unnecessary parenthesis when
printing function types, and also allows Objective-C classes
to be instantiated with nested generic types as parameters.
2016-11-18 00:39:14 -08:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00