This teaches ClangImporter to synthesize conformances of C++ iterator types to `UnsafeCxxInputIterator` protocol from the `Cxx` module.
We consider a C++ type to be an iterator if it defines a subtype (usually a typedef or a using decl) called `iterator_category` that inherits from `std::input_iterator_tag`.
rdar://96235368
Since I am beginning to prepare for adding real move only types to the language,
I am renaming everything that has to do with copyable types "move only wrapped"
values instead of move only. The hope is this reduces/prevents any confusion in
between the two.
When synthesizing the default initializer for an actor, we'd sometimes hit
a cycle when that initializer needs to chain to NSObject.init. The cycle
only happens because we ask if the initializer we're trying to synthesize
is a convenience init in a scenario which only applies to non-final classes.
Since all actors are effectively "final" classes, it's valid to workaround the
cycle by only asking that initializer question for non-final classes, thus
breaking the cycle.
Before the introduction of parameterized existential types, there
was no generic structure under these types. Now that there is, we'll
need to recurse into them to pick up any latent generic types
and lower them appropriately.
rdar://94320481
The ObjCMethodLookupTable for protocols was not being serialized and rebuilt on load, so NominalTypeDecl::lookupDirect() on selectors was not working correctly for deserialized types. Correct this oversight.
This patch should fix a warning triggered because `PreModuleImportCallback`
is initialized before other `ASTContext` members.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This patch adds an optional callback function member to the AST Context.
The callback gets invoked when a new module (or overlay module) gets
loaded.
This can be used for instance by other clients, such as lldb, to perform
actions when a module gets loaded, like showing progress to the end-user.
rdar://94165195
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This patch adds an optional callback function member to the AST Context.
The callback gets invoked when a new module (or overlay module) gets
loaded.
This can be used for instance by other clients, such as lldb, to perform
actions when a module gets loaded, like showing progress to the end-user.
rdar://94165195
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
- Add a `[reflection]` bit to `alloc_box` instructions, to indicate that a box
should be allocated with reflection metadata attached.
- Add a `@captures_generics` attribute to SILLayouts, to indicate a type layout
that captures the generic arguments it's substituted with, meaning it can
recreate the generic environment without additional ABI-level arguments, like
a generic partial application can.
This prepares us to generalize ObjC selector collision diagnostics to also include protocols. NFC in this commit because, even though Sema and ClangImporter now try to record ObjC methods on non-`ClassDecl`s, `NominalTypeDecl::createObjCMethodLookup()` still doesn’t create ObjC method tables for them, so the calls are no-ops.
* [Distributed] dist actor always has default executor (currently)
* [Distributed] extra test for missing makeEncoder
* [DistributedDecl] Add DistributedActorSystem to known SDK types
* [DistributedActor] ok progress on getting the system via witness
* [Distributed] allow hop-to `let any: any X` where X is DistActor
* [Distributed] AST: Add an accessor to determine whether type is distributed actor
- Classes have specialized method on their declarations
- Archetypes and existentials check their conformances for
presence of `DistributedActor` protocol.
* [Distributed] AST: Account for distributed members declared in class extensions
`getConcreteReplacementForProtocolActorSystemType` should use `getSelfClassDecl`
otherwise it wouldn't be able to find actor if the member is declared in an extension.
* [Distributed] fix ad-hoc requirement checks for 'mutating'
[PreChecker] LookupDC might be null, so account for that
* [Distributed] Completed AST synthesis for dist thunk
* [Distributed][ASTDumper] print pretty distributed in right color in AST dumps
* wip on making the local/remote calls
* using the _local to mark the localCall as known local
* [Distributed] fix passing Never when not throwing
* fix lifetime of mangled string
* [Distributed] Implement recordGenericSubstitution
* [Distributed] Dont add .
* [Distributed] dont emit thunk when func broken
* [Distributed] fix tests; cleanups
* [Distributed] cleanup, move is... funcs to DistributedDecl
* [Distributed] Remove SILGen for distributed thunks, it is in Sema now!
* [Distributed] no need to check stored props in protocols
* remote not used flag
* fix mangling test
* [Distributed] Synthesis: Don't re-use AST nodes for `decodeArgument` references
* [Distributed] Synthesis: Make sure that each thunk parameter has an internal name
* [Distributed/Synthesis] NFC: Add a comment regarding empty internal parameter names
* [Distributed] NFC: Adjust distributed thunk manglings in the accessor section test-cases
* cleanup
* [Distributed] NFC: Adjust distributed thunk manglings in the accessor thunk test-cases
* review follow ups
* xfail some linux tests for now so we can land the AST thunk
* Update distributed_actor_remote_functions.swift
Co-authored-by: Pavel Yaskevich <xedin@apache.org>
This ensures that opened archetypes always inherit any outer generic parameters from the context in which they reside. This matters because class bounds may bind generic parameters from these outer contexts, and without the outer context you can wind up with ill-formed generic environments like
<τ_0_0, where τ_0_0 : C<T>, τ_0_0 : P>
Where T is otherwise unbound because there is no entry for it among the generic parameters of the environment's associated generic signature.
For a class-constrained existential type 'P & C', the opened existential signature
is <Self where Self : P, Self : C>.
If the class type is generic, like 'P & C<T>', then this also works if T is an
archetype, because we get <Self where Self : P, Self : C<T>> and 'T' is an
archetype from the outer generic environment. However if T is an interface type,
we end up building an invalid signature because the opened existential
signature does not have the generic parameter for T.
Instead of crashing deeper in the Requirement Machine, guard against this case
with an assert in getOpenedArchetypeSignature().
We want to avoid feeding invalid type parameters into the Requirement Machine
when checking if a protocol requirement overrides another protocol requirement
in an inherited protocol.
In order to do that we need to make sure the potential override has a
compatible generic signature before we attempt substitution, just like we
already do for classes.
To do that, we need a way to 'rewrite' a generic signature for the base
requirement into a generic signature that can be compared with the derived
requirement, just as we do with class methods.
For protocols this is a little easier than with class methods, since protocols
only ever have a single 'Self' generic parameter. So just add the
'Self : DerivedProto' requirement to the base requirement's signature and
rebuild.