Commit Graph

411 Commits

Author SHA1 Message Date
Allan Shortlidge
cf5888a149 NFC: Refactor conveniences for filtering out unavailable decls.
Introduce `AvailableDuringLoweringDeclFilter` which can be composed with
`OptionalTransformRange` to implement iterators that filter out unavailable
decls.
2023-08-07 18:59:49 -07:00
Allan Shortlidge
496d29c47f AST: Remove FragileFunctionKind.allowUsableFromInline.
It was effectively always true after allowing default argument expressions to
reference `@usableFromInline` decls.
2023-07-12 12:47:06 -07:00
Allan Shortlidge
b9262e5297 Sema: Allow default arguments to access @usableFromInline decls.
The restriction that default arguments be disallowed from accessing
`@usableFromInline` decls is overbearing for library developers who need to
write non-trivial code to compute a default value, since it forces them to
either write a verbose closure inline in the function signature or expose a
`public` helper function which unnecessarily expands API surface. A
`@usableFromInline` function a more reasonable way to encapsulate a verbose
default value computation.

This reverses the semantic changes included in https://github.com/apple/swift/pull/15666.

Resolves rdar://112093794.
2023-07-12 12:47:06 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Doug Gregor
e89fdd3084 Requestify the computation of the list of memberwise initialized properties.
Fixes rdar://110776763, a case where initialized stored properties
introduced by peer macros weren't working alongside declared stored
properties.
2023-06-23 11:34:52 -07:00
Pavel Yaskevich
5613006944 [Sema] PreCheck: Diagnose standalone self within init accessors
'self' within init accessor could only be used to refer to
properties listed in `initializes` and `accesses` attributes.
2023-06-13 10:58:50 -07:00
Richard Wei
9c91d1b705 [Macros] Fix lookup of macro-produced variables (#65939)
Calling `getInnermostDeclContext()->getParentSourceFile()` on a macro-produced decl does not seem to be a reliable way to obtain the macro expansion source file, because `PatternBindingDecl` is not a `DeclContext` and `getInnermostDeclContext()` falls back outside the macro expansion file. This patch switches to using `getSourceFileContainingLocation` when possible.

Resolves rdar://109376568.
2023-05-18 15:32:21 -07:00
Ellie Shin
08485d4dd6 formatting 2023-03-10 16:43:38 -08:00
Ellie Shin
671533fed2 Associate PackageUnit with ModuleDecl
* Weakly reference ModuleDecl from PackageUnit
* Add PackageUnit decl context getter and use it for a package AccessScope
* Return module decl referenced by PackageUnit in getModuleScopeContext and getParentModule
* Handle package acl in access scope checkers
* Remove AccessLimitKind
* Fix tests
Resolves rdar://104987295, rdar://105187216, rdar://104723918
2023-03-10 16:19:32 -08:00
Ellie Shin
7d23db3646 Create PackageUnit class, and Package entries to DeclContext / ASTHierarchy
Previously enum AccessLimitKind was
added to distinguish access scopes b/t package and public while keeping
DeclContext null but it proved to be too limiting. This PR creates package specific entries for DeclContext and
ASTHierarchy. It create a new class PackageUnit that can be set as the parent DeclContext of ModuleDecl. This PR
contains addition of such entries but not the use of them; the actual use of them will be in the upcoming PRs.

Resolves rdar://106155600
2023-03-02 13:20:51 -08:00
Allan Shortlidge
f1a8740ba5 AST: Only treat @backDeployed functions as fragile on platforms with an active attribute.
Previously, typechecking and SILGen would treat a function body as fragile as long as the declaration had a `@backDeployed` attribute, regardless of the platform specified by the attribute. This was overly conservative since back deployed functions are only emitted into the client on specific platforms. Now a `@backDeployed` function can reference non-`public` declarations on the platforms it is resilient on:

```
@backDeployed(before: iOS 15)
public func foo() {
  #if os(iOS)
  // Fragile; this code may be emitted into the client.
  #else
  // Resilient; this code won't ever be exposed to clients.
  #endif
}
```

Resolves rdar://105298520
2023-02-23 10:39:42 -08:00
Holly Borla
f04f512184 [Macros] Add a new macro role for attached peer macros. 2023-02-10 14:38:22 -08:00
Doug Gregor
956e81c14e Add API to get the "outermost" parent source file. 2023-02-08 15:40:00 -08:00
Ellie Shin
258b13b05d Merge pull request #63355 from apple/es-export-pr
Add access level and scope checks to package types
2023-02-03 15:20:29 -08:00
Ellie Shin
be20333a87 Add access level and scope checks to package types
Resolves rdar://104617227
2023-02-02 16:51:17 -08:00
Allan Shortlidge
d2524a6de8 AST: Implement parsing support for the accepted spelling of @backDeployed for SE-0376.
For source compatibility `@_backDeploy` continues to be accepted as a spelling.

rdar://102792909
2023-02-01 22:04:33 -08:00
Holly Borla
f6f57a8099 [Macros] Rename "synthesized member macros" to "member macros". 2023-01-26 21:52:36 -08:00
Holly Borla
07319d0fdd [ASTScope] Teach ASTScope lookup to find source locations inside macro-expanded
scopes.

ASTScope lookup can no longer assume that all scopes are within the same source
file. Scope trees can now contain scopes that are in macro expansion buffers, which
live in different source files with independent source ranges from the root of a
given scope tree. To handle this when searching for a scope containing a given source
location, ASTScope lookup needs to walk up the chain of macro expansion buffers to find
the lowest common buffer in which to compare source locations.

This fixes a number of issues with unqualified lookup into and from within macro-expanded
code.
2023-01-25 23:19:33 -08:00
Ellie Shin
f26f810cc8 Merge pull request #62704 from apple/es-pkg2
[NFC] Modify AccessScope to allow checks for package access level
2023-01-19 09:09:27 -08:00
Ellie Shin
288dbe3842 Modify AccessScope to allow checks for package access level
Resolves rdar://103534243
2023-01-19 01:43:53 -08:00
Doug Gregor
dfa3ed910d Teach DeclContext::getParentSourceFile() to return the innermost source file
With macro expansions, and really any code generation that produces
proper source locations, the parent source file of a declaration
context will be a generated source file rather than the source file
near the top of the declaration-context stack. Adjust the
implementation of `getParentSourceFile()` to return that innermost
source file by doing location-based lookup.
2023-01-08 11:40:02 -08:00
Pavel Yaskevich
7d54af84ea [AST] RuntimeMetadata: Add new initializer context to cover runtime attrs 2022-12-20 09:45:01 -08:00
Doug Gregor
b29fcb4e58 [Macros] Parse macro declarations fully, and treat them as normal declarations 2022-11-28 18:32:43 -08:00
Doug Gregor
5ab6b72604 [Macros] Turn Macro into a declaration node.
Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
2022-11-13 12:21:29 -08:00
Hamish Knight
cfd24354e1 [Sema] Fix missing operator diagnostic logic
Introduce a `getTopmostDeclarationDeclContext`
utility to ensure we ensure we don't visit a
`nullptr` DeclContext for an erroneous module
under `-experimental-allow-module-with-compiler-errors`.

Additionally, tweak the insertion location such
that we insert at the start of any attributes
present.

rdar://97267326
2022-07-28 12:55:53 +01:00
Josh Soref
81d3ad76ac Spelling ast (#42463)
* spelling: accessor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: accommodates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: argument

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: associated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: availability

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: belongs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bookkeeping

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: building

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clonable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: closure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: concatenated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conformance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: context

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correspondence

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declarations

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declared

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: defining

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: delayed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deployed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: descendants

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnostic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: equitable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: evaluation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exclusivity

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existence

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: explicit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expressed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: for

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: foreign

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: function

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: identifier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implicit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indices

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: information

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interchangeable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interface

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: introduced

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: invalid

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kind-in

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: least

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: library

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: location

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: namespace

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: not

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: number

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: obtains

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: opaque

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overridden

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameter

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: precede

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preceding

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: property

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: protocol

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: qualified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recognized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recursively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: references

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: relaxing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: represented

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: request

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requirement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requirements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retrieve

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: returned

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: satisfied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: satisfy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: scanner

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: siblings

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: source

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specializations

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specially

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: statement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: stripped

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: structure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: substitution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transform

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transformed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transitively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transparent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: typecheck

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unlabeled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unqualified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: whether

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: with

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: scanner

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-21 12:57:16 -07:00
Becca Royal-Gordon
3f06999cb2 [NFC] Print clang location of imported decls
…in DeclContext::dumpContext(). This makes the dumps more usable since these declarations otherwise don’t have usable filenames or line numbers.
2022-04-21 01:15:24 -07:00
Alex Hoppen
cbbca3801f [CodeCompletion] Teach TypeCheckASTNodeAtLocRequest to check initializers
This simplifies the logic in `ide::typeCheckContextAt` and fixes an issue that prevent code completion from working inside variables that are initialized by calling a closure.

Fixes rdar://90455154 [SR-16012]
Fixes rdar://85600167 [SR-15495]
2022-04-04 14:41:59 +02:00
Evan Wilde
c34f7055f8 Detach enable-experimental-async-top-level flag
SE-0343 is approved so it's time to pull the feature out from behind the
experimental feature flag. This patch pulls it out and deprecates
passing the flag to the frontend so that we can pull it out entirely
eventually.
2022-03-15 16:07:03 -07:00
Allan Shortlidge
e39c55023f AST: Add support for @_backDeploy on computed properties, subscripts, and accessors. 2022-03-01 13:29:09 -08:00
Allan Shortlidge
25b59cb8bc AST: Emit @_backDeploy function bodies into .swiftinterface files.
Resolves rdar://88650341
2022-02-11 14:47:32 -08:00
Evan Wilde
3b90b08582 Use presence of 'await' to make top-level async
To help maintain source-compatibility, the presence of an `await` in
top-level code to kick the top-level code over to being a concurrent
context.

This, of course, means that in the test cases that exist today, they
will go back to behaving identically to how they did before I added all
of this because they don't have any awaits in the top-level. I'll be
adding new tests to verify the differences in behavior between swift 5,
swift 6, with and without async top level enabled in the next commit.
2022-01-28 07:55:14 -08:00
Evan Wilde
794d0e0b9a Merge pull request #40832 from etcwilde/ewilde/async-top-level
A first pass at concurrency in top-level code
2022-01-21 13:24:51 -08:00
Kavon Farvardin
6823744779 reimplement nonisolated initializing exprs for instance properties
It's possible to create an impossible set of constraints for
instance-member stored properties of a type. For example:

@MainActor func getStatus() -> Int { /* ... */ }
@PIDActor func genPID() -> ProcessID { /* ... */ }

class Process {
  @MainActor var status: Int = getStatus()
  @PIDActor var pid: ProcessID = genPID()

  init() {} // Problem: what is the isolation of this init?
}

We cannot satisfy the isolation of the initilizing expressions,
which demand that genStatus and genPID are run with isolation
from a non-async designated initializer, which is not possible.

This patch changes the isolation for those initializer expressions
for instance members, saying that the isolation is unspecified.

fixes rdar://84225474

The first attempt to do this was in
https://github.com/apple/swift/pull/40652
But, I implemented that as a hard source break, since the isolation
was changed in a way that an error diagnostic would be emitted.
This commit reimplements the change more gently, as a warning for
Swift 5 users.
2022-01-19 13:01:22 -08:00
Evan Wilde
8e7943df8a Make TopLevelCode async context
This patch makes the FileUnit and TopLevelCodeDecl contexts asynchronous
contexts when the `-enable-experimental-async-top-level` flag is passed.
2022-01-12 15:40:39 -08:00
Evan Wilde
cce3e8a7f5 Merge pull request #40149 from etcwilde/ewilde/concurrency/underscored-unavailablefromasync
Add `_unavailableFromAsync` attribute
2021-12-06 12:38:53 -08:00
zoecarver
f3b7a40f1e [nfc][cxx-interop] Mark lazy member loading complete only after members are loaded. 2021-11-30 11:54:58 -08:00
Evan Wilde
46d84bef4d Add 'isAsyncContext' to DeclContext
Querying the context for whether it is an async context is the easiest
way to detect if the context is async. Many decl contexts can be checked
at any point, but AbstractClosureExpr contexts must have been
typechecked. If this is called on an AbstractClosureExpr before the
types have been assigned, it may either crash or do bad things.
2021-11-30 11:11:34 -08:00
zoecarver
eeeb27d66e [cxx-interop] Add members to the LookupTable where possible.
If possible, add imported members to the StructDecl's LookupTable rather than adding them directly as members. This will fix the issues with ordering that #39436 poorly attempted to solve during IRGen.

This also allows us to break out most of the test changes from #39436.
2021-10-13 11:53:58 -07:00
Slava Pestov
4a019f0662 Sema: Improved recovery from circular generic signature construction
Returning a null GenericSignature is not the right way to break a cycle,
because then callers have to be careful to handle the case of a null
GenericSignature together with a non-null GenericParamList, for example
in applyGenericArguments().

An even worse problem can occur when a GenericSignatureRequest for a
nested generic declaration requests the signature of the parent context,
which hits a cycle. In this case, we would build a signature where
the first generic parameter did not have depth 0.

This makes the requirement machine upset, so this patch implements a new
strategy to break such cycles. Instead of returning a null
GenericSignature, we build a signature with the correct generic
parameters, but no requirements. The generic parameters can be computed
just by traversing GenericParamLists, which does not trigger more
GenericSignatureRequests, so this should be safe.
2021-09-04 00:13:03 -04:00
Becca Royal-Gordon
59bb325e4b [NFC] Factor out ASTContext operator news
Many, many, many types in the Swift compiler are intended to only be allocated in the ASTContext. We have previously implemented this by writing several `operator new` and `operator delete` implementations into these types. Factor those out into a new base class instead.
2021-08-19 11:19:52 -07:00
Holly Borla
28caecbc0f [Sema] Generalize PropertyWrapperInitializer to work with regular wrapped
properties.
2021-08-05 11:54:00 -04:00
Robert Widmann
d86551de67 Lift Requirement and Parameter Accessors up to GenericSignature
Start treating the null {Can}GenericSignature as a regular signature
with no requirements and no parameters. This not only makes for a much
safer abstraction, but allows us to simplify a lot of the clients of
GenericSignature that would previously have to check for null before
using the abstraction.
2021-07-22 23:27:05 -07:00
Slava Pestov
a250688a50 AST: Use availability to disambiguate multiple overlapping conformances
If a conformance is found in an imported module as well as the current module,
and one of the two conformances is conditionally unavailable on the current
deployment target, pick the one that is always available.

Fixes <rdar://problem/78633800>.
2021-06-07 00:45:59 -04:00
Slava Pestov
56da3f45b5 AST: Add a fast path for IterableDeclContext::getBodyFingerprint()
getParsedMembers() on imported and deserialized contexts has to pull
in all the members. This is wasteful. Imported contexts do not have
fingerprints at all, and fingerprints of deserialized contexts  are
serialized separately.

The fast path handles these cases, only calling down to
getParsedMembers() if the parent FileUnit is a SourceFile.
2021-05-11 13:26:11 -04:00
Robert Widmann
9e496d38f9 Add a Null Check for Missing Generic Signatures
When an extension is nested inside of an invalid decl context, it is
going to pull the signature of its nearest enclosing context instead of
its extended type. This leads to a null signature since the nearest
enclosing context for an extension should always be its parent source
file.

rdar://76049852
2021-04-02 09:43:35 -07:00
Holly Borla
b821c8d76b [Sema] Add an implicit applied property wrapper expression and a new
dedicated initializer context for this expressions.
2021-02-25 18:35:14 -08:00
Slava Pestov
9ca2a708a6 AST: Remove SPI bit from AccessScope
As far as I can tell, it wasn't actually used for anything.
2021-02-09 18:22:29 -05:00
Doug Gregor
c4e265e280 [Type checker] Add "all members" request.
Introduce an "all members" request to compute all of the members of a
given iterable declaration context in stable order. This builds on ABI
members so that it will also include, e.g., type aliases synthesized
for associated types.
2021-01-20 12:56:32 -08:00
Doug Gregor
a8f7f0d4e5 [AST] Rename "semantic members" to "ABI members".
The "semantic members" query produces the list of members that can
affect the ABI, e.g., of classes. It does not produce the complete
list of members suitable for semantic queries.
2021-01-20 12:56:31 -08:00