Commit Graph

3132 Commits

Author SHA1 Message Date
Doug Gregor
814e5205e9 [Observable] Test macro through the plugin server 2023-06-21 13:43:10 -07:00
Yuta Saito
5cf10f29e0 [test] Make KeyPath test pointer-size agnostic
The field offset of the `age` property is 16 bytes on 64-bit platforms
but not on other pointer-sized platforms.
2023-06-20 17:45:15 +00:00
Doug Gregor
504b76a7ab [Macros] Add test using observer accessors (didSet/willSet) with Observable
At one point this gave us trouble, but it's since been fixed. Add the
test to make sure we don't regress. Covers rdar://109231047.
2023-06-16 22:53:27 -07:00
Hamish Knight
3f401fb134 [test] Require asserts for a couple of tests 2023-06-15 12:28:55 +01:00
Stephen Canon
185820a148 Fix sign of fractional units in Duration initializers from Double. (#66582)
* Fix sign of fractional units in Duration initializers from Double.

When separating a double duration into integral and fractional parts, we got the sign wrong. This fixes that bug.

* Fixup variable name.
2023-06-13 08:46:46 -04:00
Doug Gregor
1209ef89ec Ensure that macros within init accessors are expanded early enough
Now that we've made accessor macro expansion more lazy, ensure that
when querying for init accessors (e.g., to build a memberwise
initializer), we also expand any accessor macros that might produce an
init accessor.

This is a partial step toward the real goal, which is that
`AbstractStorageDecl::getAccessor()` should lazily expand macros if
needed.

Update the Observable macro to document that it produces an `init`
accessor.
2023-06-11 08:48:43 -07:00
Philippe Hausler
4d1d8a9de5 [Observation] Add property definite initialization support (#65984)
* [Observation] Transition to peer macros instead of arbitrary members

* [Observation] Lift the initializer requirement by utilizing init accessors for fully formed definite initialization

* [Observation] Gate enabling of peer macros by flag

* [Observation] Enable feature for InitAccessors in the observation tests

* [Observation] Add tests to validate memberwise and definite initialization
2023-06-09 15:15:39 -07:00
Hamish Knight
7a137d6756 [CS] Allow ExprPatterns to be type-checked in the solver
Previously we would wait until CSApply, which
would trigger their type-checking in
`coercePatternToType`. This caused a number of
bugs, and hampered solver-based completion, which
does not run CSApply. Instead, form a conjunction
of all the ExprPatterns present, which preserves
some of the previous isolation behavior (though
does not provide complete isolation).

We can then modify `coercePatternToType` to accept
a closure, which allows the solver to take over
rewriting the ExprPatterns it has already solved.

This then sets the stage for the complete removal
of `coercePatternToType`, and doing all pattern
type-checking in the solver.
2023-06-07 00:35:01 +01:00
Mike Ash
01300a6f86 [Runtime] Fix memory leak in -[__SwiftNativeNSError description] for large error values.
Balance the call to allocateBufferIn with a call to deallocateBufferIn. When an error value is small, the missing deallocateBufferIn doesn't do anything. But when the error value is a larger struct that doesn't fit inline, we need deallocateBufferIn to avoid leaking the allocation.

rdar://109933822
2023-06-01 12:54:19 -04:00
Stephen Canon
db0a7287a5 Rework the .seconds, .milliseconds, and .microseconds constructors to preserve exact values (#66111)
When constructing a Duration from Double, we should do it in such a way that exact integer inputs are preserved exactly, so long as they are represented as a Duration. This was not previously the case. Now it is.
2023-05-24 23:07:17 -04:00
Philippe Hausler
ddbab22d88 [Observation] Member properties that have visibility attributes should rename using trailing trivia (#65812) 2023-05-18 11:36:47 -07:00
Pavel Yaskevich
a987861d1c Merge pull request #65806 from xedin/rdar-108977234
[CSSimplify] Detect and diagnose conformance failures related to AnyHashable conversion
2023-05-16 09:56:41 -07:00
Pavel Yaskevich
58ffca8f74 [ConstraintSystem] Don't produce partially matching note if none of the overloads matched 2023-05-09 14:11:38 -07:00
Nate Cook
89b9e48eae [stdlib] Implement Never conformance to Codable (#64899)
Proposed as SE-0396: Conform Never to Codable;
approved on 5/5/2023.
2023-05-09 13:10:10 -05:00
Philippe Hausler
d37b6bc074 [Observation] Reduce observation scope to only apply to tracking cases and re-work the macro to utilize more robust emissions (#65528) 2023-05-09 09:28:25 -07:00
Alejandro Alonso
73e749d985 Merge pull request #65594 from Azoy/identitycastthing
[stdlib] Add a conditional identity cast
2023-05-03 16:17:45 -07:00
Alejandro Alonso
4c8c828889 Rename to _specialize 2023-05-03 09:41:09 -07:00
Mike Ash
a6bab7332d [Reflection] Handle -disable-reflection-names in _forEachField.
Invoke our callback with an empty name string when reflection names are disabled, rather than throwing a fatal error.

rdar://108709009
2023-05-03 08:55:28 -04:00
Alejandro Alonso
e381815580 Add a conditional identity cast 2023-05-02 13:37:08 -07:00
Karoy Lorentey
32811bac9f Merge pull request #65471 from lorentey/adopt-pointerBitwidth
[stdlib] Adopt _pointerBitWidth conditional
2023-04-28 13:58:28 -07:00
Doug Gregor
10027fbab1 [Macros] Add test that triggered a reference cycle.
Fixes rdar://108565923.
2023-04-28 08:36:05 -07:00
Karoy Lorentey
b82ce9c3be [stdlib] Adopt _pointerBitWidth conditional 2023-04-27 13:33:24 -07:00
Alejandro Alonso
3360e41c9c Add SPI to reroot a keypath for a given superclass 2023-04-24 17:15:28 -07:00
Egor Zhdan
a785ea18d6 Fix symbol-visibility-linux.test-sh on CentOS
rdar://108041802
2023-04-15 00:31:27 +01:00
Doug Gregor
2bcef82eb5 Merge pull request #65032 from DougGregor/attached-macro-mangle-without-cycles 2023-04-12 12:58:35 -04:00
Alejandro Alonso
6ec8a8c60f Merge pull request #64904 from Azoy/keypath-create-spi
[stdlib] Create an offset based keypath at runtime
2023-04-12 09:24:40 -07:00
Doug Gregor
fb82b8f711 Fix Linux flaky test completely 2023-04-11 23:40:32 -04:00
Doug Gregor
097ecfd545 Fix fragile test 2023-04-11 23:40:32 -04:00
Karoy Lorentey
a1dae65528 [stdlib] Adjust availability of _CharacterRecognizer conformances
These never made it to 5.8, so their availability needs to be bumped to 5.9.
2023-04-11 16:43:06 -07:00
Nate Chandler
68a35726ce [Test] Simplified two test cases.
Now that Array is eagerMove, a different type needs to be used to test
the behavior of `consume` regarding uniqueness.  Used a class and
otherwise restored the test case to its previous usage of consume,
replacing `._buffer.isUniquelyReferenced()` with `_isUnique_native`.

rdar://107642615
2023-04-05 08:15:27 -07:00
Nate Chandler
90f7af22c9 [SILOpt] Run DestroyAddrHoisting in mandatory.
Run DestroyAddrHoisting in the pipeline where DestroyHoisting was
previously running.  Avoid extra ARC traffic that having no form of
destroy hoisting in the mandatory pipeline results in.

rdar://90495704
2023-04-04 11:11:34 -07:00
Alejandro Alonso
3522a338a2 Create function to create an offset based keypath at runtime 2023-04-04 09:44:18 -07:00
Ben Barham
e5a28caa9a [Test] Fix swift_swift_parser feature and use in tests
The macro tests were all using "REQUIRES: OS=macosx" as a proxy for
"have the Swift Swift parser". There was an existing feature for this,
but it was just checking whether the path was passed through. Fix that
to use the same variable as in CMake.

Also remove all extraneous `-I` and `-L` to the host libs in the target
invocations.
2023-04-03 09:25:03 -07:00
swift-ci
9a55a9d1b6 Merge pull request #64782 from phausler/pr/observation_test_supported_targets
[Observation] Restrict tests for observation to only use built stdlib's and not test in back-deployment
2023-03-30 17:33:34 -07:00
nate-chandler
5e0267b9b7 Merge pull request #64553 from nate-chandler/eagermove_collections
[stdlib] Collection types are eagerMove.
2023-03-30 16:16:26 -07:00
Philippe Hausler
ddeb10e53c [Observation] Restrict tests for observation to only use built stdlib's and not test in back-deployment 2023-03-30 12:41:32 -07:00
Nate Chandler
cda365ca8d [stdlib] Collection types are eagerMove.
Types that have "value semantics" should not have lexical lifetimes.
Value types are not expected to have custom deinits. Are not expected to
expose unsafe interior pointers. And cannot have weak references because
they are structs. Therefore, deinitialization barriers are irrelevant.

rdar://107076869
2023-03-30 11:04:47 -07:00
Alejandro Alonso
aa3fd951d2 Merge pull request #64731 from Azoy/update-unicode-15
[stdlib] Update the stdlib to use Unicode 15 data
2023-03-29 22:49:38 -07:00
Alejandro Alonso
f16f0c3c23 Update the stdlib to use Unicode 15 data 2023-03-29 10:18:16 -07:00
Kavon Farvardin
2be061cb06 explicitly enable MoveOnly feature for some stdlib tests
We ran into an issue on minimal stdlib build configurations, because they
pull slightly older toolchains to build and test the stdlib. Adding this flag
doesn't hurt anything and just ensures things will work with older compilers.
But it is not needed and should eventually be safe to remove.

part of resolving rdar://106849189
2023-03-24 16:03:11 -07:00
Philippe Hausler
7fd2f52af8 [Observation] Refactor for state machine (and behavior robustness) and adjust protocol requirement names (#64414)
* [Observation] Change visibility of observation runtime functions to be hidden

* [Observation] Update API requirements for Observable AsyncSequence names and alter the behavior of value emissions to be based upon transactionality

* [Observation] Slight naming alteration of isolation -> isolatedTo

Note: This re-enables the previously disabled tests since the implementation should be considerably more robust to hangs.
2023-03-16 22:11:23 -07:00
azharudd
f964104473 Temporarily disable test stdlib/NSStringAPI.swift
It is taking too long to execute.
2023-03-15 17:00:24 -07:00
Alejandro Alonso
31389f7368 Merge pull request #64371 from Azoy/bye-bye-reflection
Remove Reflection
2023-03-15 10:13:46 -07:00
Kavon Farvardin
a8a44ebb17 Merge pull request #64106 from kavon/enable-moveonly-by-default
Enable moveonly / noncopyable types by default
2023-03-15 09:59:29 -07:00
Kavon Farvardin
528d2cfca1 enable full optimizations in test
doesn't seem to be a need to skip destroy hoisting
anymore.
2023-03-14 18:35:13 -07:00
Alejandro Alonso
8505415ce6 Remove Reflection Sources and tests 2023-03-14 15:09:44 -07:00
Philippe Hausler
5c8b2ea30c [Observation] Disable some of the tests for now 2023-03-14 09:28:57 -07:00
Philippe Hausler
81aa9b51ff [Observation] Add some behaviroal tests for changes, transactions, and tracking (#64179)
* [Observation] Add some behaviroal tests for changes, transactions, and tracking

* Correct transactions to properly suspend when awaiting for changes
2023-03-08 09:04:08 -08:00
Ben Barham
c542a8834f [Test] Add another C++ symbol to the visibility filter 2023-03-06 09:15:37 -08:00
Evan Wilde
221c727d14 Merge pull request #64108 from etcwilde/ewilde/fix-symbol-list
Add cxx119to_string to ignored symbol list for linux
2023-03-04 20:48:50 -08:00