Commit Graph

2588 Commits

Author SHA1 Message Date
Kavon Farvardin
ff3ea642b1 NCGenerics: increase baseline test coverage
During feature bringup, it's handy to have tests always running in CI to prevent outside regressions.
2024-02-20 18:26:05 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Dario Rexin
7a4fcc6841 [Runtime] Mask out reserved bits for SwiftError in BytecodeLayouts.cpp (#71669)
rdar://122911427

These bits can be used for storing multi payload enum tags and not masking them out can cause crashes an other unexpected behavior.
2024-02-16 08:59:22 -08:00
Kavon Farvardin
08b71e0136 NCGenerics: rebuild stdlib from its interface
When a NoncopyableGenericsMismatch happens between the compiler and
stdlib, allow the compiler to rebuild the stdlib from its interface
instead of exiting with an error.
2024-02-15 18:08:54 -08:00
Kavon Farvardin
3dda59fea7 Sema: improve function cast checking
Functions can in fact conform to some protocols, notably,
marker protocols. Dynamically they have no influence on whether the cast
will succeed or not, as there is no way to tell if a type conforms to
such a protocol at runtime. But we should check them statically because
they otherwise can be cast to Any eventually.
2024-02-07 14:54:37 -08:00
Kavon Farvardin
3ab4c7548c Sema: ban extensions of known marker protocols
There's no good reason to permit them. Conformances like Copyable and
Sendable are pervasive, so it's as though we are permitting extensions
of `Any`. Until there's a good argument in favor of such extensions,
remove the capability now.
2024-02-07 14:54:36 -08:00
Dario Rexin
747cbfcc24 [IRGen] Mask extra tag bits in getEnumTag function for CVW (#71421)
rdar://121868127

In compact value witnesses we need to mask the extra tag bits in case they are used to store tag bits of outer enums, so we only read the ones we are interested in.
2024-02-07 08:58:07 -08:00
Ellie Shin
e38bc9756c Merge pull request #71083 from apple/es-sil-pkg
Support a package SILLinkage
2024-02-07 09:10:13 +09:00
nate-chandler
f98b211f18 Merge pull request #71403 from nate-chandler/delete-flag
[Frontend] Removed enable-lexical-borrow-scopes flag.
2024-02-06 07:00:25 -08:00
Ellie Shin
72a7760027 Support package SIL linkage.
Decls with a package access level are currently set to public SIL
linkages. This limits the ability to have more fine-grained control
and optimize around resilience and serialization.
This PR introduces a separate SIL linkage and FormalLinkage for
package decls, pipes them down to IRGen, and updates linkage checks
at call sites to include package linkage.

Resolves rdar://121409846
2024-02-06 01:23:14 -08:00
Nate Chandler
ddccaa7d9c [Frontend] Removed lexical-borrow-scope flag.
Adding `move_value [lexical]` and `begin_borrow [lexical]` should happen
all the time at this point.  Remove the ability to omit these
instructions and update the corresponding tests.
2024-02-05 17:34:10 -08:00
Kavon Farvardin
b67ace7de1 Merge pull request #71137 from kavon/ncgenerics-enable-stdlib-v1
NCGenerics: synthesize Copyable/Escapable decls
2024-02-02 21:16:14 -08:00
Pavel Yaskevich
a77d119c99 Merge pull request #71261 from xedin/introduce-thunks-for-runtime-check-func-refs
[Sema/SILGen] DynamicActorIsolation: Implement dynamic actor isolation checks for unsafe APIs
2024-02-02 13:32:00 -08:00
Kavon Farvardin
6f6ab4ab75 [NCGenerics] add basic end-to-end test 2024-02-02 11:11:17 -08:00
Kavon Farvardin
afb668519e [NCGenerics] test for Mutator pattern
covers rdar://117867086
2024-02-02 11:11:17 -08:00
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Dario Rexin
55e565d838 [Runtime] Handle different types for src and dest in existentialAssignWithCopy (#71323)
rdar://117083470

An existential can contain a different type than the one that is being assigned, so we have to check the types and handle the values accordingly.
2024-02-02 08:34:37 -08:00
Pavel Yaskevich
db7959668e [Frontend] NFC: Rename PreconcurrencyConformances to DynamicActorIsolation 2024-02-01 13:28:25 -08:00
Mike Ash
590c33ed70 [Runtime] Correctly initialize side tables of immortal objects on 32-bit.
The code to copy the refcounts from the object to a new side table wasn't quite right on 32-bit. Fix it to copy the PureSwiftDealloc field, and if the object is immortal, mark the side table's refcount as immortal too.

rdar://121943608
2024-01-31 17:08:06 -05:00
Allan Shortlidge
da2d250105 Tests: Loosen CHECK: lines matching _diagnoseUnavailableCodeReached().
Depending on deployment target and platform, the function called to diagnose
reaching unavailable code could be `_diagnoseUnavailableCodeReached()` itself,
the back-deployment thunk, or the `@_alwaysEmitIntoClient` variant of the
function.

Resolves rdar://121344690
2024-01-29 09:09:26 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Pavel Yaskevich
c3a0822260 [Tests] NFC: Disable availability checking in @preconcurrency conformances tests 2024-01-16 16:21:06 -08:00
Pavel Yaskevich
65b07e91b7 [SILGen] Emit expected executor preconditions for synchronous isolated @preconcurrency witness thunks
For `@preconcurrency` conformance witness thunks replace hop to
executor with a precondition to make sure that the thunk is always
called in the expected context.
2024-01-16 11:51:49 -08:00
Allan Shortlidge
e5c6bb649c Remove support for Swift 3 @objc inference.
Obsolete the `-enable-swift3-objc-inference` option and related options by
removing support for inferring `@objc` attributes using Swift 3 rules.
Automated migration from Swift 3 has not been supported by the compiler for
many years.
2024-01-11 15:40:04 -08:00
Meghana Gupta
5d2454f3e3 Merge pull request #68180 from meg-gupta/lowerb4inline
Lower OwnershipModelEliminator to just before inlining
2024-01-10 13:53:34 -08:00
Slava Pestov
25789fd767 Merge pull request #70768 from slavapestov/fix-119822466
SIL: Fix DynamicSelfType references from inside init accessor
2024-01-10 13:40:46 -05:00
Slava Pestov
1a06313ac9 SIL: Fix DynamicSelfType references from inside init accessor
We need the self metatype parameter to correctly lower
DynamicSelfType in IRGen, so plumb this through to all
calls of init accessors, and inside the prolog of an
init accessor definition.

This does not break the public ABI, because init
accessors are never public. Also for value types, the
metatype is thin, so it should not change generated
code.

For classes we need the metatype in the general case
because of `Self`, but hopefully in most cases the
init accessor can be inlined away and the value_metatype
instruction subject to dead code elimination.

Fixes rdar://problem/119822466.
2024-01-09 10:52:54 -05:00
Meghana Gupta
ce242691a6 Bail out of ossa rauw for move only values 2024-01-05 23:10:45 -08:00
Slava Pestov
93ad779f84 Merge pull request #70694 from slavapestov/two-ci-fixes
A couple of small fixes for CI
2024-01-04 10:39:22 -05:00
Eric Miotto
a566c10d3d Use %target-swiftc_driver in objc_class_properties_runtime.swift (#70689)
This way we will compile the test program with `-Xlinker
-headerpad_max_install_names`, which will allow
`swift-darwin-postprocess.py` to amend the install names without errors.

Take the chance to remove the `-target` parameter -- that is already
provided by %target-swiftc_driver, and we have no need to enforce it to
be at least `macosx10.11` (since by virtue of build-script defaults and
Xcode in CI we don't support anything lower than `macosx10.13`)

Addresses rdar://119907089
2024-01-04 07:16:59 -08:00
Slava Pestov
ab15ddad4e test/Interpreter/rdar119541554.swift requires macOS 14
Fixes rdar://119948707.
2024-01-03 16:28:22 -05:00
Allan Shortlidge
edcec43098 Revert "Frontend: Temporarily disable stubbing unavailable decls."
This reverts commit ad604f2803.
2024-01-03 11:01:00 -08:00
Dario Rexin
b238c16f51 [IRGen] Disable simple single payload enum in layout strings (#70528)
rdar://119792426

There are a few issues with wrong assumptions around extra inhabitants that cause tags to not be identified properly in some cases. Until a proper fix is identified, we emit tag functions instead.
2023-12-20 14:55:52 -08:00
Rintaro Ishizaki
c2fa7c5bae [Test] Disable objc_class_properties_runtime.swift
rdar://119907089
2023-12-20 14:17:15 -08:00
Slava Pestov
79e9b96835 AST: Fix ExistentialLayout::isObjC() handling of marker protocols
Fixes rdar://problem/119541554.
2023-12-15 15:33:44 -05:00
Becca Royal-Gordon
e9672194b4 Merge pull request #69468 from beccadax/c-implementation
Make @objcImpl work with @_cdecl
2023-12-14 00:36:12 -08:00
Joe Groff
6812e6164b Merge pull request #70422 from jckarter/codesign-moveonly-interpreter-tests
Add missing %target-codesign to moveonly execution tests.
2023-12-13 14:59:44 -08:00
Becca Royal-Gordon
8651af4325 Make @objcImpl work with @_cdecl
No real diagnostics yet, but we’re emitting mostly correct code.
2023-12-13 11:09:49 -08:00
Joe Groff
0022816a10 Add missing %target-codesign to moveonly execution tests. 2023-12-13 08:17:19 -08:00
Allan Shortlidge
ad604f2803 Frontend: Temporarily disable stubbing unavailable decls.
This feature should be disabled until rdar://119046537 is solved.
2023-12-12 15:46:57 -08:00
Joe Groff
957443e16c Merge pull request #70404 from jckarter/modify-coroutines-yielding-noncopyable-values
Move-only-check the result of modify coroutines.
2023-12-12 14:38:48 -08:00
Joe Groff
18e31157fd Move-only-check the result of modify coroutines.
Following https://github.com/apple/swift/pull/70333, do the same thing for
modify coroutines, marking the result so that we check uses of the result to
ensure it isn't consumed (without being reinitialized).
2023-12-12 09:02:24 -08:00
Dario Rexin
7b8fc50dcd [Test] Fix integer overflow in layout_string_witnesses_dynamic.swift on 32 bit targets (#70290)
rdar://119268608
2023-12-07 11:59:31 -08:00
Pavel Yaskevich
da052e5b27 [TypeChecker] Allow @dynamicMemberLookup subscript index to compose key path with protocols
Allow to compose key path type with a protocol as a way to express
additional requirements on the parameter. For example:

```
struct Test<R> {
  subscript<V>(dynamicMember member: KeyPath<R, V> & Sendable) -> V {
    ...
  }
}
```
2023-11-30 11:34:58 -08:00
Pavel Yaskevich
3d6ddd58c8 [TypeChecker] NFC: Add test-cases verify that sendability of key path exprs is inferred correctly 2023-11-28 13:48:00 -08:00
Dario Rexin
011fce8212 [Runtime] Fix leak of bridge objects in swift_generic_initWithTake (#69977)
rdar://118606044

The initWithTakeTable accidentally referenced bridgeRetain instead of copyingInitWithTake, which caused a leak when an object containing a bridge reference was also not bitwise takable.
2023-11-27 08:04:10 -08:00
Dario Rexin
506fbb3c91 [Runtime] Fix alignment of tuples in runtime layout string instantiation (#69975)
rdar://118366415

If a tuple was not already aligned, this would cause a wrong offset to be used in the layout string.
2023-11-27 08:03:38 -08:00
Joe Groff
a759703115 Merge pull request #69919 from jckarter/test-resilient-error-handling-same-file
Add test for error handling path combinations in same file as a resilient type.
2023-11-16 14:41:56 -08:00
Joe Groff
91a489b9b2 Add test for error handling path combinations in same file as a resilient type.
In local testing, I found that the compiler is inserting double deinits in some cases.
2023-11-16 10:14:57 -08:00
Joe Groff
1b91ad7e8e Merge pull request #69899 from jckarter/resilient-capture-self-during-deinit
SILGen: Mark constant captures for no_consume_or_assign checking instead of may_assign_but_not_consume.
2023-11-16 07:51:52 -08:00