Commit Graph

3290 Commits

Author SHA1 Message Date
Doug Gregor
b272a05ea9 Merge pull request #76363 from DmT021/wp/print-diagnostic-groups
[Diagnostics] Add -print-diagnostic-groups flag
2024-09-11 13:04:07 -07:00
Pavel Yaskevich
c49aeaf177 Merge pull request #76354 from xedin/improve-mismatch-diagnostics-in-optional-context
[CSSimplify] Rework how/when mismatches between optional types are fixed
2024-09-11 10:14:19 -07:00
Mike Ash
b35a2a11f1 Merge pull request #76309 from mikeash/mirror-thin-metatypes
[Mirror] Handle fields of thin metatypes.
2024-09-11 10:52:05 -04:00
Dmitrii Galimzianov
a8b71ea97f Add -print-diagnostic-groups flag
This change adds the `-print-diagnostic-groups` flag as described by SE-0443.
2024-09-11 13:34:42 +02:00
Pavel Yaskevich
55b8d9538d [CSSimplify] Rework how/when mismatches between optional types are fixed
- Don't attempt to insert fixes if there are restrictions present, they'd inform the failures.

  Inserting fixes too early doesn't help the solver because restriction matching logic would
  record the same fixes.

- Adjust impact of the fixes.

  Optional conversions shouldn't impact the score in any way because
  they are not the source of the issue.

- Look through one level of optional when failure is related to optional injection.

  The diagnostic is going to be about underlying type, so there is no reason to print
  optional on right-hand side.
2024-09-10 10:35:05 -07:00
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
swift-ci
a377cfa315 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 13:33:57 -07:00
Mike Ash
7d3451316a [Mirror] Handle fields of thin metatypes.
Fields containing metatypes with no possible subtypes are thin i.e. they have no storage. There is only one possible value they can have: the corresponding type. Mirror attempted to copy the nonexistent field value from the nonexistent storage, producing garbage. Instead, special-case thin metatypes and copy the instance type out of the metatype metadata rather than trying to copy it from the field.

rdar://108280543
2024-09-06 10:38:25 -04:00
Ben Langmuir
081774ab07 [test] Fix stdlib/Reflection_objc.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.
2024-08-30 09:10:45 -07:00
Ben Langmuir
dc5e6d88c2 [test] ignore deprecations
Ignore some deprecation warnings associated with the deployment target
bump.
2024-08-30 09:10:14 -07:00
swift-ci
0572bce91f Merge remote-tracking branch 'origin/main' into rebranch 2024-08-26 10:02:41 -07:00
Allan Shortlidge
1c9b6eb723 Sema: Relax availability of typealiases for inferred type witness.
Only constrain the availability of the synthesized typealias for an inferred
type witness by the availability of the associated type if the associated type
is less available than its protocol. Without this, source compatibility is
broken for some conformances. For example:

```
struct IdentifiableValue: Identifiable {
  let id = 42
}

extension IdentifiableValue {
  // error: 'ID' is only available in macOS 10.15 or newer
  var nextID: ID {
    return id + 1
  }
}

```

Fixes a regression introduced by https://github.com/swiftlang/swift/pull/71496.

Resolves rdar://134584323
2024-08-23 15:49:51 -07:00
swift-ci
618033ec28 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-17 09:33:52 -07:00
Doug Gregor
73ecefd1e6 Merge pull request #75913 from DougGregor/typed-throws-with-unsafe-buffer-ptr
Adopt typed throws in withUnsafe(Mutable)BufferPointer
2024-08-17 09:16:49 -07:00
swift-ci
c0e923905b Merge remote-tracking branch 'origin/main' into rebranch 2024-08-16 22:54:45 -07:00
Yuta Saito
ba63b9f628 Merge pull request #75821 from kateinoigakukun/pr-680047d2b871e809cf13f27c8a4a5abc2f5c31d2
[wasm] Annotate errno as SwiftPrivate by apinotes
2024-08-17 14:35:42 +09:00
Doug Gregor
417828e7bd Add a test for typed throws and withUnsafe(Mutable)BufferPointer 2024-08-16 11:13:20 -07:00
Yuta Saito
be08ebb12a [wasm] Annotate errno as SwiftPrivate by apinotes
This patch adds an apinotes file for SwiftWASILibc clang module to mark
`errno` macro hidden from Swift code. This resolves ambiguity between
the C macro definition and the Swift wrapper in WASILibc overlay module.

This change installs the apinotes file to the resource directories for
both lib/swift/apinotes and lib/swift_static/apinotes.
2024-08-16 10:57:24 +00:00
swift-ci
cc5aff75b8 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-15 13:30:18 -07:00
Ben Langmuir
85d9acf138 [stdlib][test] Remove problematic else branches in availability checks
Testing the old behaviour can cause issues when the new availability
gets properly defined. Just check the new behaviour, which is what we
are doing in other stdlib tests.
2024-08-14 09:37:22 -07:00
Becca Royal-Gordon
58ba7046c0 Merge pull request #75849 from beccadax/rebranch-modulemap
Rename module.map -> module.modulemap in tests
2024-08-13 02:17:36 -07:00
Becca Royal-Gordon
fd84e7273d Rename module.map -> module.modulemap in tests
The legacy `module.map` spelling of module map files was deprecated by llvm/llvm-project#75142 and clang expects to remove support for them in the future. Switch all tests to use the supported spelling.

Fixes rdar://128431478.
2024-08-12 17:47:26 -07:00
Alex Lorenz
d35af38ce4 Merge pull request #75721 from hyp/eng/75691
[windows] split out complex module from ucrt module, to allow new swi…
2024-08-12 08:30:47 -07:00
Ben Langmuir
c55402882a Merge pull request #75788 from benlangmuir/stdlib-61-check-test
[stdlib][test] Update string printing availability checks
2024-08-09 09:23:29 -07:00
Ben Langmuir
56fa3e54c8 [stdlib][test] Update string printing availability checks
The change in behaviour that these checks covered is not currently in 6.0,
only in main. Update the availability check to use stdlib 6.1.
2024-08-08 15:10:41 -07:00
Alex Lorenz
cecd4c050b Fixup the CRT api test 2024-08-08 09:45:06 -07:00
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Alex Lorenz
b62eafd866 [windows] split out complex module from ucrt module, to allow new swift-foundation to import ucrt when C++ interoperability is enabled
Fixes https://github.com/swiftlang/swift/issues/75691
2024-08-06 11:33:03 -07:00
Alexis Laferrière
cd2dcca196 Tests: Disable ArrayBridge.swift.gyb when use_os_stdlib (rdar://132941962) 2024-07-31 17:13:36 -07:00
Erik Eckstein
75d71e3ed2 tests: disable stdlib/NSValueBridging.swift.gyb for watchos 2024-07-31 10:24:47 +02:00
Xiaodi Wu
ea1baed83a Address 128-bit integer comparison type inference issue (#75529) 2024-07-28 21:38:38 -07:00
Allan Shortlidge
6fb6a56b20 SILGen: Introduce macCatalyst support for if #available.
Upstream the necessary changes to compile `if #available` queries correctly
when a `macabi` target triple or a `-target-variant` is specified.
2024-07-23 17:00:10 -07:00
Tim Kientzle
48eb993349 Verify that hash/equality behavior is all consistent
It's not obvious that we can check that hash/equality behavior
is entirely correct, since there are two very different behaviors
which depend on environmental factors that are not easy to test for.

But we can do a quick probe to see whether the current environment
seems to be offering the legacy or non-legacy behavior and then
carefully verify that everything else is consistent with our initial
probe.

This gives us confidence that at least we're not getting inconsistent
behavior.
2024-07-09 13:30:13 -07:00
David Smith
3589044213 A new way to bridge constant NSStrings (#74881) 2024-07-03 20:38:33 -07:00
Karoy Lorentey
470a04cca3 Merge pull request #73807 from lorentey/stdlib-noncopyable-additions
[stdlib] API additions for basic noncopyable primitives
2024-06-20 13:32:23 -07:00
Tim Kientzle
eac09d613f Disable this test for now...
The underlying behavior of __SwiftValue bridging now has
a couple of different possible behaviors depending on how
libswiftCore was built and even (in some cases) the specific binary that's
running.

This makes it very hard to craft an accurate test of this functionality.
Disable it (for now) until we can figure out a better way to
conditionalize the expected behavior here.
2024-06-14 16:53:45 -07:00
Konrad `ktoso` Malawski
8848a52fae [Concurrency] CaseIterable synthesized allCases must be nonisolated 2024-06-11 12:42:07 +09:00
Karoy Lorentey
ab51f1630c [stdlib] API additions for basic noncopyable primitives
- Add `exchange(_:with:)`
- Add `Optional.take()`
- Add `Unsafe[Mutable]BufferPointer.extracting(_:)`
- Finish generalizing `withExtendedLifetime`
- Radically simplify the implementation of `swap(_:_:)`
2024-06-07 14:09:53 -07: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