Dispatch requests the ability to add a new case, but to treat missing
instances of that case in patterns as warnings instead of errors. It is
still an error to make reference to the annotated case in at least one
pattern then not cover the rest of the space, but it is not an error
to omit the space of patterns referencing the case entirely.
This attribute is private and uglified to intentionally discourage
its use outside just this one use case.
A lot of files transitively include Expr.h, because it was
included from SILInstruction.h, SILLocation.h and SILDeclRef.h.
However in reality most of these files don't do anything
with Exprs, especially not anything in IRGen or the SILOptimizer.
Now we're down to 171 files in the frontend which depend on
Expr.h, which is still a lot but much better than before.
Extensive cross-language tooling support needs to bridge decl names between two different languages more freely. This SourceKit request is designed to translate Objc names to Swift names and vice versa. Working similarly to cursor-info requisition, the name translation request requires a Swift reference to a Swift/Clang decl, and the preferred name to translate from, and language kind that the given name belongs to. If the translation succeeds, SourceKit service responds with the corresponding name than belongs to the other kind of language.
Newly introduced keys:
“key.namekind": “source.lang.name.kind.objc” | "source.lang.name.kind.swift"
“key.basename”: “name"
“key.argnames”: [“name"]
“key.selectorpieces”: [“name[:]"]
This commit only implements translation from Objc to Swift.
Like cursor-info, range info (""source.request.cursorinfo"") answers some
questions clients have for a code snippet under selection, for instance, the type of a selected
expression. This commit implements this new quest kind and provides two
simple information about the selected code: (1) the kind of the
snippet, currently limited to single-statement and expression; and (2)
the type of the selected expression. Gradually, we will enrich the
response to provide more insight into the selected code snippet.
What I've implemented here deviates from the current proposal text
in the following ways:
- I had to introduce a FunctionArrowPrecedence to capture the parsing
of -> in expression contexts.
- I found it convenient to continue to model the assignment property
explicitly.
- The comparison and casting operators have historically been
non-associative; I have chosen to preserve that, since I don't
think this proposal intended to change it.
- This uses the precedence group names and higherThan/lowerThan
as agreed in discussion.
Typically, users jump to type-specific interface from a member of that type, for
instance, a.getSomething(). To generate the interface, we need to report the USR
of the container type of "getSomething()", which is the USR for the type of a,
when cursor info is requested for this function call.
The mangled name of the type is identical to those for debugger. These
mangled names allow us to reconstruct the type from AST and generate interface
specifically for that type.
Related rdar://27306890
As a first step toward having more detailed "role" information, thread
through a SymbolRole bitset. For now it just contains the existing ref
vs. definition status.
The goal is to be able to move the core IndexSwiftASTWalker code out of
SourceKit, leaving only the serialization bits behind.
Mostly this replaces some direct uses of UIdent strings with explicit
enums, and then adds the translation code to produce those enums and to
convert them into UIdents in SourceKit.
rdar://problem/22348041
We may know syntactically that we have an operator without being able to
find the associated operator decl when the input is invalid/incomplete.
Don't crash when that happens, and just fallback to a "free function"
decl kind.
rdar://problem/25196625
For decls it can be interesting to know when a decl is a parameter vs. a
local. This will be needed for the new fully annotated decls. For refs
it's usually not interesting.
rdar://problem/24292226
Adds an associatedtype keyword to the parser tokens, and accepts either
typealias or associatedtype to create an AssociatedTypeDecl, warning
that the former is deprecated. The ASTPrinter now emits associatedtype
for AssociatedTypeDecls.
Separated AssociatedType from TypeAlias as two different kinds of
CodeCompletionDeclKinds. This part probably doesn’t turn out to be
absolutely necessary currently, but it is nice cleanup from formerly
specifically glomming the two together.
And then many, many changes to tests. The actual new tests for the fixits
is at the end of Generics/associated_types.swift.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.
SourceKit is disabled on non-darwin platforms.