Most of AST, Parse, and Sema deal with FileUnits regularly, but SIL
and IRGen certainly don't. Split FileUnit out into its own header to
cut down on recompilation times when something changes.
No functionality change.
Accessors logically belong to their storage and can be synthesized
on the fly, so removing them from the members list eliminates one
source of mutability (but doesn't eliminate it; there are also
witnesses for derived conformances, and implicit constructors).
Since a few ASTWalker implementations break in non-trivial ways when
the traversal is changed to visit accessors as children of the storage
rather than peers, I hacked up the ASTWalker to optionally preserve
the old traversal order for now. This is ugly and needs to be cleaned up,
but I want to avoid breaking _too_ much with this commit.
Make sure they handle the case when a property wrapper type's constructor is
called with the first argument coming from the var initializer, and the rest
from the custom attribute's argument.
This fixes custom attribute syntax highlighting on parameters and functions
(where function builders can be applied). They weren't being walked in
the function position previously and were walked out of source order in the
parameter position.
It also fixes rename of the property wrapper and function builder type
names that can appear in custom attributes, as well as rename of property
wrapper constructors, that can appear after the type names, e.g.
`@Wrapper(initialValue: 10)`. The index now also records these constructor
occurrences, along with implicit occurrences whenever a constructor is
called via default value assignment, e.g. `@Wrapper var foo = 10`, so that
finding calls/references to the constructor includes these locations.
Resolves rdar://problem/49036613
Resolves rdar://problem/50073641
When building the implicit subscript expression, set the "implicit" bit
correctly and pass it through in the indexer so that we get implicit
refernces to the subscript. This would be useful for e.g. searching for
all uses of the dynamic subscript.
Currently includes both the implicit references to the
subscript(dynamicMember:) and the explicit references to the underlying
property/subscript declarations.
rdar://49028783
`\.self` is the final chosen syntax. Implement support for this syntax, and remove the stopgap builtin and `WritableKeyPath._identity` property that were in place before.
As for `OpenExistentialExpr`, normal ASTWalker walks into the existential
expression first, then walks into sub expression. However,
`SourceEntitiyWalker` must walk AST tree by source order. Handle
`OpenExistentialExpr` and its `OpaqueValueExpr` so that
`SourceEntityWalker` walks to them in "outer to inner" manner.
rdar://problem/41147733
If walking into body of defer statement returns nullptr, it indicates
*cutting-off* walking. Previously there was wrong assertion where it
must be unmodified, non-nullptr return.
rdar://problem/41100570
After 7400d484 we tried to walk into enum elements, but forgot to check
for missing types (which caused an assertion in getType) or element
decls (which caused an assertion or crash inside passReference).
rdar://problem/24634223
When one spells a compound declaration name in the source (e.g.,
insertSubview(_:aboveSubview:), keep track of the locations of the
base name, parentheses, and argument labels.
When users try to print the interface of a specific type (most often through cursor
infor query of SourceKit), we should simplify the original decls by replacing
archetypes with instantiated types, hiding extension details, and omitting
unfulfilled extension requirements. So the users can get the straight-to-the-point
"type interface". This commit builds the testing infrastructure for this feature,
and implements the first trick that wraps extension contents into the interface body.
This commit also moves some generic testing support from SourceKit to Swift.
Swift SVN r32630
With this change, TypeReprs no longer contain fully-resolved types for
any parsed code. Rather, they contain unresolved identifiers or the
declarations to which the identifiers have resolved.
As a minor space optimization, collapse the unbound (Identifier)
representation and the bound (ValueDecl *) representation into a
single pointer union.
Swift SVN r32434
Having bound types in TypeReprs causes trouble in several places
(mostly involving type-checking of generics), and doesn't really fit
with TypeReprs being a mostly syntactic construct. Eliminate some code
paths using getBoundType(), and make the others do the same thing for
getBoundDecl() and getBoundType(). As part of the latter, provide
TypeBase::getDirectlyReferencedTypeDecl() to more easily map from type
to the named declaration.
Swift SVN r32018
When SourceEntityWalker visits a subscript reference it sometimes needed to visit
both open and close brackets. It used to be implemented as two calls to a regular
visitDeclReference which confused the clients expecting one call per a reference,
for example indexing was recording two references to a subscript.
We add a separate visitSubscriptReference to resolve this problem.
Swift SVN r31494
This returns to the behaviour we had before ModuleDecl came about. It
fixes an assertion in SourceKit concerning the kinds of decls we will
visit in visitDeclReference. As the comments indicate, we need this
special case until Swift supports first class submodules.
Swift SVN r28934
declarations generated by the type-checker.
Unfortunately, it's not possible to directly check this
because the verifier is itself based on ASTWalker. But I'm
going to add an assertion to SILGen in a follow-up that
assumes that TypeCheckError has visited every ApplyExpr,
and since SILGen already walks most of the AST with its
own custom walker, that will check this well enough.
Swift SVN r28732
Now that we don't have generic parameter lists at arbitrary positions
within the extended type of an extension declaration, simplify the
representation of the extended type down to a TypeLoc along with a
(compiler-synthesized) generic parameter list.
On the parsing side, just parse a type for the extended type, rather
than having a special grammar. We still reject anything that is not a
nominal type (of course), but it's simpler just to call it a type.
As a drive-by, fix the crasher when extending a type with module
qualification, rdar://problem/20900870.
Swift SVN r28469
Make unqualified lookup always provide a declaration for the things it
finds, rather than providing either a module or a declaration. Unify
various code paths in our type checker now that module declarations
come in with the other declarations.
Swift SVN r28286