Commit Graph

7604 Commits

Author SHA1 Message Date
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Tim Kientzle
ea87a273d7 Redesign the spare bit mask calculation
This adds a `getSpareBits` method to all the TypeInfo classes
that returns a suitable bitmask indicating the spare bits available
in values of this type.  This gives us a way to recursively explore
the type tree and build up a full spare bit mask for an arbitrary type.

Happily, it appears we actually do have enough information to do this
calculation entirely from first principles, without requiring additional
reflection information.  So once this is stable, we should remove my
earlier incomplete effort to publish spare bit mask info in the reflection
data, as that adds unnecessary metadata to every binary.

This doubtless still has plenty of holes, but seems sufficient
to handle a few basic enum types, including the stdlib DecodingError
which was used as an example to work out some key issues.
2024-05-07 14:17:00 -07:00
swift-ci
c30af15f40 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-06 23:14:44 -07:00
Erik Eckstein
eac23edc65 tests: deprecate the swift_in_compiler lit feature
Now that SwiftCompilerSources are always enabled, `swift_in_compiler` is not needed anymore.
Set this feature unconditionally for tests which still include `REQUIRES: swift_in_compiler`.
2024-05-06 17:22:27 +02:00
Arnold Schwaighofer
195fe84e18 [rebranch] Fix validation-test/IRGen/pack_stack_metadata_alloc_loop.sil 2024-05-03 13:06:35 -07:00
swift-ci
ed8ed34a6f Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 21:14:11 -07:00
Konrad `ktoso` Malawski
dc5e354d69 [Concurrency] Reimplement @TaskLocal as a macro (#73078) 2024-05-01 20:57:20 -07:00
Arnold Schwaighofer
fdb050d2cf IRGen: Fix some test cases for llvm rebranch 2024-05-01 09:30:15 -07:00
saehejkang
33c666a855 [SILGen]: Add test for parenthesized try expression 2024-04-29 17:57:02 -07:00
nate-chandler
c1ecef79dc Merge pull request #73191 from nate-chandler/rdar125265980
[IRGen] Deadends don't need dealloc_pack_metadata.
2024-04-24 16:17:08 -07:00
Nate Chandler
da38fb51fb [IRGen] Deadends don't need dealloc_pack_metadata.
There is a debug-build-only verification that is done for
alloc_pack_metadata instructions that checks that there exist paired
dealloc_pack_metadata instructions which will be keyed off of to clean
up the on-stack variadic metadata packs corresponding to (the
instruction after) the alloc_pack_metadata.

StackNesting omits the deallocation instruction (as does
PackMetadataMarkerInserter) if it would be created in a dead end block.
If all blocks in the dominance frontier of the alloc_pack_metadata
instruction are dead-end blocks, then the verification will incorrectly
fail.  It should not fail because it is not necessary to clean up the
on-stack pack metadata (or any other stack allocations) in such a case.

If all such blocks are dead-end blocks, however, the
alloc_pack_metadata's block itself is a dead-end block as well.  So
during the verification, check whether the alloc_pack_metadata occurs in
a dead-end block and do not fail verification if it does.

rdar://125265980
2024-04-24 07:24:20 -07:00
Nate Chandler
5325a4d5f8 [MoveOnlyAddressChecker] Fix empty struct repr.
An empty struct without a deinit gets a single bit which is used to
track the struct's liveness.  Previously, an empty struct with a deinit
also only got a single bit.  Consequently, when discarding the struct
(i.e. dropping the deinit), there was no bit left to represent the
struct.  This resulted in a failure to track liveness for the value.

rdar://126863003
2024-04-22 08:42:14 -07:00
Nate Chandler
de8f1c0b69 [NoncopyablePartialConsumption] Promote to feature 2024-04-19 12:37:34 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Alex Hoppen
9fca2ff0ff Merge pull request #72568 from ahoppen/ahoppen/type-relation-of-call-pattern
[CodeCompletion] Don’t report a call pattern as convertible if its result type doesn’t match
2024-04-12 13:16:51 -07:00
nate-chandler
b1e5a5dfbb Merge pull request #72978 from nate-chandler/rdar126275392
[NoncopyablePartialConsumption] Promote to upcoming feature.
2024-04-11 14:13:14 -07:00
Nate Chandler
943cc3cc7c [NoncopyablePartialConsumption] Enable.
SE-429 was accepted.

rdar://126275392
2024-04-11 08:19:29 -07:00
Yuta Saito
65723193a9 [embedded] Use @_extern(c) instead of @_silgen_name for putchar in tests
Using inconsistent attributes between stdlib and tests causes
compilation errors. There are still several misuses of @_silgen_name in
tests, but leaving them as is for now to incrementally fix them.
2024-04-11 10:37:25 +00:00
Alex Hoppen
278ecef284 [CodeCompletion] Don’t report a call pattern as convertible if its result type doesn’t match
To compute the expected type of a call pattern (which is the return type of the function if that call pattern is being used), we called `getTypeForCompletion` for the entire call, in the same way that we do for the code completion token. However, this pattern does not generally work. For the code completion token it worked because the code completion expression doesn’t have an inherent type and it inherits the type solely from its context. Calls, however, have an inherent return type and that type gets assigned as the `typeForCompletion`.

Implement targeted checks for the two most common cases where an expected type exists: If the call that we suggest call patterns for is itself an argument to another function or if it is used in a place that has a contextual type in the constraint system (eg. a variable binding or a `return` statement). This means that we no longer return `Convertible` for call patterns in some more complex scenarios. But given that this information was computed based on incorrect results and that in those cases all call patterns had a `Convertible` type relation, I think that’s acceptable. Fixing this would require recording more information in the constraints system, which is out-of-scope for now.
2024-04-10 16:06:47 -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
Meghana Gupta
5ced6cc00d Disable test Runtime/issue-51181.swift 2024-04-09 12:57:51 -07:00
Meghana Gupta
9112760248 Disable failing test on arm64 2024-04-09 11:53:57 -07:00
Meghana Gupta
85f960f366 Disable SequenceType.swift.gyb failing on freestanding 2024-04-08 10:16:16 -07:00
Slava Pestov
454e5cff67 Merge pull request #72825 from slavapestov/two-minor-fixes-and-tests
RequirementMachine: Fix two minor crash on invalid bugs
2024-04-03 22:42:24 -04:00
Slava Pestov
ae73cd4637 RequirementMachine: Fix an incorrect assertion
We don't expect to see type parameters that are not generic parameters
here, but dependent member types that wrap an ErrorType are fine, they
show up when a conformance had an invalid type witness.

Fixes the remaining example from https://github.com/apple/swift/issues/59384.
2024-04-03 19:37:20 -04:00
Slava Pestov
c1dc44643c Add regression test for rdar://111991454 2024-04-03 15:11:59 -04:00
Holly Borla
a3ac8ec28f [Test] Remove overload of count(where:) from type checker performance test now
that it's in the standard library.
2024-04-02 08:33:05 -07:00
Holly Borla
8834861218 [ConstraintSystem] Order VarDecls before other kinds of decls in disjunctions. 2024-04-01 17:19:53 -07:00
Nate Cook
38e1370884 Revert "Revert count(where:)" (#70816)
* Revert "Revert count(where:)"

This reverts commit 779ea19a6a.

Now that SE-0220 has been re-accepted, this adds the `count(where:)` 
Sequence method to the standard library.
2024-03-29 13:53:53 -05:00
Eric Miotto
efdd4954d3 build-script: add flag to pass arguments to dsymutil
This is currently needed to disable DWARF verification in
some Apple internal configurations.

Addresses rdar://125092216
2024-03-22 08:04:31 -07:00
Guillaume Lessard
bd77f106c7 Merge pull request #72443 from Azoy/58-to-59
[test] Change availability guarding test in StringGraphemeBreaking.swift
2024-03-19 20:56:08 -07:00
Alejandro Alonso
4aa7a8bd3f Change availability guarding test 2024-03-19 15:42:42 -07:00
Doug Gregor
922e3daaea Remove build infrastructure for globally enabling noncopyable types
Now that the compilation model of noncopyable types is enabled everywhere,
and one can enable the feature for specific modules, we no longer need a
separate build-script/CMake option to enable it globally. Remove it all.
2024-03-19 13:35:31 -07:00
Karoy Lorentey
9725b892cc [test] More test updates 2024-03-18 13:27:46 -07:00
Kavon Farvardin
ca25edb848 XFAIL parse_stdlib.sil temporarily 2024-03-14 23:10:44 -07:00
Kavon Farvardin
bb51be731e Test: update for NoncopyableGenerics infra. 2024-03-14 23:10:44 -07:00
Kavon Farvardin
53fb8c3570 XFAIL test for minor issue
This test is failing to verify the generic signature for this bogus
 program, because the generic signature isn't minimal. We should
 gracefully handle this situation and still have a minimal signature,
 despite rejecting this program.
2024-03-14 23:10:44 -07:00
Allan Shortlidge
841847b009 Revert "[Regex] Really build _RegexParser without resilience."
This reverts commit 8d1b578275.

Resolves rdar://124541877
2024-03-13 16:25:21 -07:00
Tim Kientzle
7ac7d55180 Merge pull request #72290 from tbkka/tbkka-rdar123727657
Fix enum inspection of a no-payload enum inside another enum
2024-03-13 16:09:32 -07:00
Alexis Laferrière
11d7d53634 Merge pull request #72295 from xymus/xfail-arm64e
Tests: disable some tests on arm64e
2024-03-13 10:36:07 -07:00
Alexis Laferrière
f1352f0919 tests: disable stdlib/StringGraphemeBreaking.swift on arm64e 2024-03-13 10:34:52 -07:00
Tim Kientzle
35a98aad20 Fix enum inspection of a no-payload enum inside another enum
When a no-payload enum is stored inside a multi-payload enum,
the outer enum may be using some of the extra high-order bits.
So when we examine the inner enum, we should just strip those bits.
2024-03-13 09:14:37 -07:00
Arnold Schwaighofer
315a763c28 Merge pull request #72218 from aschwaighofer/fragile_resilient_protocols
IRGen: Add code to support building fragile resilient protocol witnesses
2024-03-13 08:40:44 -07:00
nate-chandler
d80854ea3b Merge pull request #72256 from nate-chandler/gh70234
[ConsumeChecker] Check guaranteed arguments.
2024-03-12 14:04:34 -07:00
Nate Chandler
863c919713 [Test] Add regression test.
For https://github.com/apple/swift/issues/70234 .
2024-03-12 08:33:16 -07:00
Nate Chandler
d8a9c428b0 [Test] Add regression test.
For https://github.com/apple/swift/issues/72055 .
2024-03-11 21:08:16 -07:00
Arnold Schwaighofer
ea70aea43c IRGen: Add code to support building fragile resilient protocol witnesses
We don't currently support building resilient relative protocol witness tables.
One might want to build with relative witness tables but not need
resilient protocols. Allow for that scenario.

Add a test configuration to test library-evolution + fragile resilient
protocols + relative protocol witness tables.
2024-03-10 09:14:08 -07:00
Slava Pestov
5afdb987e2 Merge pull request #72146 from slavapestov/ncgenerics-fixes-9
Non-copyable generics fixes, part 9
2024-03-07 22:14:33 -05:00
Slava Pestov
123045f825 Merge pull request #71780 from slavapestov/remove-non-experimental-assoc-type-inference
Remove old associated type inference implementation
2024-03-07 22:14:06 -05:00
Meghana Gupta
e96642c219 Merge pull request #72106 from meg-gupta/lifetimedepdiag
Loosen some lifetime dependence diagnostics
2024-03-07 16:32:13 -08:00