Commit Graph

3053 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
8848a52fae [Concurrency] CaseIterable synthesized allCases must be nonisolated 2024-06-11 12:42:07 +09:00
Alex Lorenz
5aa63fc93e Merge pull request #72634 from hyp/eng/android/ndk-overlay
[android] add an Android NDK Swift overlay
2024-06-05 19:35:13 -07:00
Alejandro Alonso
6bce5960a3 Update LockSingleConsumerStack.swift 2024-06-04 09:06:37 -07:00
Alejandro Alonso
726609a783 Add a basic mutex test 2024-06-04 09:06:37 -07:00
Alejandro Alonso
ce89c757cb Move atomics tests under a synchronization folder 2024-06-04 09:06:37 -07:00
Alex Lorenz
86ba2513b0 fix canImport clause in the MathConstants.swift testcase 2024-05-31 11:15:18 -04:00
Alejandro Alonso
9bc9d926c4 Update BridgedObjectDebuggerSupport.swift 2024-05-29 09:32:27 -07:00
Hamish Knight
fcc123db77 [test] Disable stdlib/ArrayBridge.swift.gyb on arm64 2024-05-28 21:56:29 +01:00
Alex Lorenz
95209ca468 update tests to use canImport(android) and make libc test for generalized 2024-05-28 13:01:15 -07:00
Alex Lorenz
0f9a69c712 android test fixes 2024-05-28 12:59:26 -07:00
Nate Chandler
746cf2ff5b [BitwiseCopyable] Drop req from SIMD/Storage.
There are conformers to SIMDStorage (like that in the added test case)
which involve an Array (a type that can't conform to BitwiseCopyable).
So lift the constraint on SIMDStorage.  This in turn requires lifting
the constraint on SIMD (otherwise, e.g. `SIMD8<Scalar>` would fail to
conform since it has as a member some SIMD8Storage which is only
constrained to conform to `SIMDStorage`; the `SIMD8Storage`
associatedtype also cannot be constrained to `BitwiseCopyable` because
that storage may again not conform as in the test example).

rdar://128661878
2024-05-24 12:32:10 -07:00
David Smith
b81aec5c1a rdar://127199021, fix compatibility with apps that accidentally do [[[aSwiftArray class] new] mutableCopy] to work (#73728) 2024-05-20 12:06:05 -07:00
Yuta Saito
d216486766 [test] Guard crash test in Duration.swift for WASI
WASI does not support crashing tests
2024-05-20 11:31:34 +00:00
Guillaume Lessard
a27d9c426a Merge pull request #71912 from oscbyspro/better-joined-distance-from-to-int-min
FlattenSequence/distance(from:to:) untrapping Int.min
2024-05-17 16:17:01 -07:00
Alejandro Alonso
db9232f246 Merge pull request #73550 from Azoy/string-debugger-changes
[debug] Print strings using their description in the debugger
2024-05-16 11:40:00 -07:00
Alejandro Alonso
528160d1cd Update BridgedObjectDebuggerSupport.swift 2024-05-15 10:03:57 -07:00
Alejandro Alonso
b2f21bbfb3 Update DebuggerSupport.swift 2024-05-15 10:02:35 -07:00
Stephen Canon
8578a0e18d Add some additional test coverage for duration static methods (#73578)
The numerics of these operations is fairly subtle, and the overflow boundaries are somewhat surprising, so additional test coverage isn't a bad thing (also gives us an excuse to exercise Int128 more)
2024-05-11 18:13:11 -04:00
Tim Kientzle
da8a0872bf Update tests to match new expectations everywhere 2024-05-10 17:10:50 -07:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Nate Chandler
c10d39e35f [AST] Remove Builtin.copy.
A vestigial remnant of it was left behind after
06921cfe84 in order to avoid a reverse
condfail when building old swiftinterfaces that define

```swift
func _copy<T>(_ value: T) -> T {
  #if $BuiltinCopy
    Builtin.copy(value)
  #else
    value
  #endif
}
```

If the language feature is removed, though, such interfaces should again
be buildable because the branch where the language feature isn't defined
should be expanded.

rdar://127516085
2024-05-04 11:35:17 -07:00
Nate Chandler
06921cfe84 [SIL] Hollow out Builtin.copy, deprecate _copy.
The copy operator has been implemented and doesn't use it.  Remove
`Builtin.copy` and `_copy` as much as currently possible.

Source compatibility requires that `_copy` remain in the stdlib.  It is
deprecated here and just uses the copy operator.

Handling old swiftinterfaces requires that `Builtin.copy` be defined.
Redefine it here as a passthrough--SILGen machinery will produce the
necessary copy_addr.

rdar://127502242
2024-05-03 15:56:25 -07:00
Kuba Mracek
1d48f28d84 [KeyPath] Fix regression in == on keypaths 2024-04-30 12:50:03 -07:00
Joe Groff
2f954ef5d7 Merge pull request #73259 from jckarter/external-key-path-generic-environment-binding
IRGen: Fix key path generic environment marshalling for external property descriptors.
2024-04-25 16:24:42 -07:00
Joe Groff
02e1f2ea15 IRGen: Fix key path generic environment marshalling for external property descriptors.
The layout of a computed key path component carries an argument buffer for captures, which has
the following layout:

```
---
captured values (subscript indices)
---
generic arguments
---
```

When we reference an externally-defined public property or subscript from a key path, and the
external declaration has a property descriptor, then the generic arguments for the external
declaration get appended to the end of this buffer, giving:

```
---
captured values (subscript indices)
---
generic arguments
---
external property's generic arguments
---
```

The convention for key path accessors to bind their generic environment is thus to unpack them
from the end of the argument buffer, so that the external keypath's accessors can find the
arguments to bind the external generic environment while still allowing the enclosing key path
to save the original captured generic environment (which may be necessary to capture the
appropriate conditional and/or retroactive `Equatable` and `Hashable` conformances for
subscript indices).

However, our code generation for binding the generic arguments out of the argument buffer
contained a flawed optimization: for a property, we know there are never any captured values,
so I had assumed that the generic parameters could always be bound from the beginning of the
argument buffer, assuming that the generic parameters make up the totality of the buffer. This
falls over for external property descriptor references when the key path itself captures a
generic environment, since the external property's expected generic environment appears after
the key path's original generic environment. We can fix this by removing the conditional
entirely, and always adjusting the offset we load the generic environment from to look at the
end of the buffer. Fixes rdar://125886333.
2024-04-25 10:36:13 -07:00
Ben Barham
412c8321c3 [Test] Add symbols visible on Ubuntu 23.10
A couple more `basic_string`:
```
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcmPKcmm
_ZSt12__str_concatINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_PKNS6_10value_typeENS6_9size_typeES9_SA_RKNS6_14allocator_typeE
```

Which are:
```
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_cold(char*, unsigned long, char const*, unsigned long, unsigned long)
```
and
```
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__str_concat<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::value_type const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::value_type const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::allocator_type const&)
```
2024-04-19 13:26:57 -07:00
Stephen Canon
8ca9e1bc59 Disable PrintFloat16 test with debug stdlib, it's slooooooow. (#73098) 2024-04-18 12:04:04 -04:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Tim Kientzle
5251750999 Conditionalize tests to supported OSes only 2024-04-10 15:30:29 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Tim Kientzle
810792843b Fill in extended existential support for type(of:) and mirror
type(of:) now returns the dynamic type of the contents of
an extended existential (just like it does for a regular existential)

Mirror can now reflect fields of a value stored inside an extended
existential (just like it can with a regular existential).  This
requires type(of:) support, since Mirror internals use that to
determine how to reflect a value.

Resolves rdar://102906195
2024-04-09 17:37:57 -07:00
Yuta Saito
c32c7f55fe [wasm] Fix build failure due to lack of _Float16 support
WebAssembly does not support _Float16 type, so we need to guard the use
of the type. Unfortunately, Clang does not provide a good way to detect
the support of _Float16 type at compile time, so just disable for wasm
targets.
2024-04-07 16:34:11 +00:00
Stephen Canon
6ac852f3f4 Move Float16 print tests to their own file and test exhaustively (#72859)
We can easily test all 2**16 values, so let's do it. Also now _Float16 is properly supported in clang, so we can pass arguments to CPP that way, which lets us get snan right on more platforms.
2024-04-05 19:55:19 -04:00
Yuta Saito
c30ba69e4f [test] Fix Int128 test on 32-bit platforms
The test used Int.min and Int.max assuming that they are 64-bit integers.
Use 64-bit integers explicitly instead.
2024-04-03 00:44:46 +00:00
Stephen Canon
a381589524 SE-0425 implementation (#72139) 2024-04-02 16:24:41 -04:00
Kavon Farvardin
554fa49a1f Test: clean-up noncopyable_generics lit usage
There no longer is a lit feature called `noncopyable_generics`, it's
just always on now.
2024-04-01 12:28:08 -07:00
Karoy Lorentey
7fc54cab80 [stdlib] MemoryLayout: Add support for non-copyable type arguments
[stdlib] MemoryLayout: Update Swift version numbers

[stdlib] MemoryLayout: Actually hide legacy ABI
2024-03-18 11:03:48 -07:00
Alexis Laferrière
81e465971c Tests: un-xfail tests on the freestanding bot 2024-03-13 13:32:41 -07:00
Alexis Laferrière
841740e7ab Tests: XFAIL a few tests on freestanding
rdar://121121793
2024-03-11 13:29:49 -07:00
Oscar Byström Ericsson
7703ae4a3b FlattenSequence/distance(from:to:) untrapping Int.min (v5).
1. FlattenSequence/distance(from:to:) cleanup.
2. FlattenDistanceFromToTests cleanup.
3. FlattenDistanceFromToTests availability checks.
2024-03-01 11:11:54 +01:00
Guillaume Lessard
18a5fc6d95 Merge pull request #71981 from glessard/rdar123810713
[test] guard a behavioral change
2024-02-29 17:21:40 -08:00
Guillaume Lessard
d463723e15 [test] guard a behavioral change
These two edge cases were fixed in https://github.com/apple/swift/pull/71369, and fail when run against an older standard library. Ensure they run only against a Swift 6.0 or newer stdlib

Addresses rdar://123810713
2024-02-29 08:24:48 -08:00
Tim Kientzle
69ef3add66 Merge pull request #71852 from tbkka/tbkka-rdar123422591
Fix hash/isEqual interop conditionals, update tests
2024-02-28 17:16:57 -08:00
Tim Kientzle
eece2b024b Fix test build 2024-02-28 10:41:51 -08:00
Ben Barham
c4111e53ee [Test] Even more visible libstdc++
```
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJS0_ImS3_EEEES0_INS6_14_Node_iteratorIS4_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJS0_ImSsEEEES0_INS6_14_Node_iteratorIS4_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE13_M_rehash_auxEmSt17integral_constantIbLb1EE
```

Which corresponds to `_M_emplace` and `_M_rehash_aux`:
```
std::pair<std::__detail::_Node_iterator<std::pair<unsigned long const, std::optional<std::string> >, false, false>, bool> std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_emplace<std::pair<unsigned long, std::optional<std::string> > >(std::integral_constant<bool, true>, std::pair<unsigned long, std::optional<std::string> >&&)
std::pair<std::__detail::_Node_iterator<std::pair<unsigned long const, std::optional<std::string> >, false, false>, bool> std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_emplace<std::pair<unsigned long, std::string> >(std::integral_constant<bool, true>, std::pair<unsigned long, std::string>&&)
std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_rehash_aux(unsigned long, std::integral_constant<bool, true>)
```
2024-02-28 09:11:31 -08:00
Oscar Byström Ericsson
d5e8bdfa48 FlattenSequence/distance(from:to:) untrapping Int.min (v4).
1. I removed some command-like comments.
2. I added a test for Int.min and Int.max distances.
2024-02-28 13:46:22 +01:00
Oscar Byström Ericsson
e06f80a978 FlattenSequence/distance(from:to:) untrapping Int.min (v3).
1. I added a file with some tests [test/stdlib/FlattenDistanceFromTo.swift].
2. I used [test/stdlib/StaticBigInt.swift] as the template for the new file.
2024-02-28 11:22:19 +01:00
Tim Kientzle
804800447d Document the test hacks more clearly 2024-02-27 17:46:49 -08:00
Tim Kientzle
fac88221c5 Fix hash/isEqual interop conditionals, update tests
Github PR #71620 mixed up one of the bincompat conditionals.
It also had some errors in the tests for ObjC interop.

For now, this leaves the legacy behavior in place for
all Apple platforms.
2024-02-27 17:46:49 -08:00
Ben Barham
5efd8802b9 [Test] Add another C++ stdlib symbol to the Linux symbol visibility test
`_ZNSt6vectorISt8optionalISt4pairISsbEESaIS3_EE17_M_realloc_insertIJRKS3_EEEvN9__gnu_cxx17__normal_iteratorIPS3_S5_EEDpOT_`

```
void std::vector<std::optional<std::pair<std::string, bool> >, std::allocator<std::optional<std::pair<std::string, bool> > > >::_M_realloc_insert<std::optional<std::pair<std::string, bool> > const&>(__gnu_cxx::__normal_iterator<std::optional<std::pair<std::string, bool> >*, std::vector<std::optional<std::pair<std::string, bool> >, std::allocator<std::optional<std::pair<std::string, bool> > > > >, std::optional<std::pair<std::string, bool> > const&)
```
2024-02-26 18:13:24 -08:00