auto-completing @attributes. By delaying the handling of code completion token after the entire decl being parsed, we know
what are the targets of the attribute to finishe, thus, only suggesting those applicable attributes.
Swift SVN r25938
If '{' is encountered immediately after 'if', assume that the condition
is missing. Apply the same treatment to while, do-while, for-in, and
switch. This way we're not trying to re-parse, backtrack, repurpose
misparsed closure bodies, etc. in those cases. Users who want to write a
condition that starts with '{' can wrap it in parens.
Addressing feedback re <rdar://problem/18940198>.
Swift SVN r25747
Otherwise we'll get all the way to IRGen and then try to emit them. And try
to reference them in serialization.
rdar://problem/19935034
Swift SVN r25567
This doesn't allow 'continue' out of an if statement for the same reason we don't
allow it on switch: we'd prefer people to write loops more explicitly.
Swift SVN r25565
un-type-annotated AnyObject binding in "if let", and allows general
patterns in if-let.
This also reverts some unrelated QoI improvements that went in with those
patches, but I'll add those back next.
Swift SVN r25507
closure, reparse it as a brace statement instead of attempting to
repurpose the closure body. Suppress diagnostics from the initial
condition parse until we're committed to that parse.
<rdar://problem/18940198> Fuzzing Swift: performTypeChecking(...) crashes in ContextualizeClosures::walkToExprPre(...): Assertion failed: "Incorrect parent decl context for closure"
Swift SVN r25438
two logically independent but related patches conflated together:
- Improve error recovery for malformed if/let conditions, particularly
when the user uses "," instead of &&. Add testcases for error recovery
requested by Jordan.
- Add a syntactic requirement that the pattern of an if/let condition be
a simple identifier or _. We allow slightly broader patterns here now,
but they will change in the future when refutable patterns are allowed.
It is best to be narrow and then open it up later so we can do a great
job of QoI then.
This includes the changes to the stdlib directory that I forgot to commit
with the patch the previous time.
Swift SVN r25408
- Improve error recovery for malformed if/let conditions, particularly
when the user uses "," instead of &&. Add testcases for error recovery
requested by Jordan.
- Add a syntactic requirement that the pattern of an if/let condition be
a simple identifier or _. We allow slightly broader patterns here now,
but they will change in the future when refutable patterns are allowed.
It is best to be narrow and then open it up later so we can do a great
job of QoI then.
Swift SVN r25371
Brace statement created for wrapping IfConfig inside TopLevelCodeDecl does not have
closing brace, so we should use the previous token’s location as right brace location.
Swift SVN r24797
if-let statements (also while and var, of course) that include multiple bindings
and where clauses.
SILGen support still remains, it currently just asserts on the new constructs.
Swift SVN r24239
initializer but has no "parent" PatternBindingDecl or Pattern (i.e.
paramdecls). This is currently set on decls in the pattern of
foreach loops and case patterns, but I'll add it to other places I
find as well.
NFC since this bit is only set and not read, just more yak shaving.
Swift SVN r23910
SILMetadata is the base class with a single enum member (MDKind).
SILBranchNode is the derived class with additional members:
unsigned NumOperands
an array of uint32_t
A static member function SILBranchNode::get is implemented to get or create
SILBranchNode. All SILMetadata created are uniqued and saved in SILModule's
member variable:
llvm::FoldingSet<SILMetadata> Metadatas
Usage of SILMetadta by SILInstruction is captured in SILModule's member variable:
llvm::DenseMap<const SILInstruction *, SILMetadata *> MetadataStore
This is similar to LLVM's Metadata. Another option is to add a SILMetadata* to
SILInstruction. The disadvantage is the waste of space when we don't have PGO on.
This commit also enables parsing and printing of SILMetadata.
We add keyword sil_metadata to define SILMetadata:
sil_metadata !0 = {"branch_weights", 3, 5}
For parsing, we add a map in SILModule
llvm::DenseMap<unsigned, SILMetadata *> NumberedMetadata
that maps from ID to SILMetadata* to help matching usage of "!id" in SILFunction
with definition of "!id" in sil_metadata section.
For printing, we assign IDs to SILMetadata at SILModule scope, we then pass in
an optional argument of
llvm::DenseMap<const SILMetadata *, unsigned> *MetadataMap
to SILFunction::print in order to get the ID of SILMetadata used in
SILInstruction.
Post-commit review will be appreciated.
rdar://18269754
Swift SVN r23713
When BraceStmt is generated to represent missing {...} block it should be marked as
implicit and be associated with the owning statement.
Swift SVN r23531
This already can't happen in most circumstances because of trailing closures, but we didn't explicitly disallow it at the beginning of a BraceStmt or following a statement production. Fixes the parser part of rdar://problem/17850752 (though there's a type checker bug there too).
Swift SVN r21663
source location of synthesized AST nodes to point to EOF. This causes the
source range to span more tokens than the parent node does.
rdar://17630645
Swift SVN r21282
attribute. As part of this, introduce a new "NotSerialized" flag in Attr.def.
This eliminates a bunch of special case code in the parser and elsewhere for handling
this modifier.
Swift SVN r19997
Introduce the new BooleanLiteralConvertible protocol for Boolean
literals. Take "true" and "false" as real keywords (which is most of the
reason for the testsuite churn). Make Bool BooleanLiteralConvertible
and the default Boolean literal type, and ObjCBool
BooleanLiteralConvertible. Fixes <rdar://problem/17405310> and the
recent regression that made ObjCBool not work with true/false.
Swift SVN r19728
This patch extends the syntax with a new #line directive that is inspired
by the homonymous CPP directive. It can be specified in all locations a #if
is legal (Stmt, Decl).
Semantics
---------
#line 42 "file.swift"
This makes diagnostics and debug information behave as if the subsequent
lines came from file.swift+42.
#line // without arguments
This switches back to the main source file and the switches back to the
normal line numbering. Any previous #line directives will result in gaps
in the main file.
Rationale
---------
LLDB and the REPL need this for making expressions that are entered into
the expression evaluator or REPL debugable. For more info see
<rdar://problem/17441710> Need #line directive or something similar so we can enhance the debugging of expressions and REPL
Also, I believe the stdlib would benefit from this and it would allow us
to get rid of the line-directive wrapper script.
Swift SVN r19384
We were working around this in several different places, which was
error-prone (see <rdar://problem/17479771>). This way, we always have
usable left/right delimiter locations.
Swift SVN r19292
- Mine conjunction constraints for constraint failure data. (rdar://problem/16833763)
- Rather than crash, add a diagnostic to signify a missing user constraint. (rdar://problem/16747055) I don't have a deterministic repro for this to include as a test, but users hit it from time to time, I'd like to address this issue holistically, and we're hoping that the new diagnostic will help us collect isolated repros.
- As promised, remove the temporary "compiler_submit_version" build configuration predicate in time for WWDC. (rdar://problem/16380797)
Swift SVN r17705
go back to disallowing ; in switch statements, people should use break
for empty statements. It is much more explicit and obvious what you mean.
Swift SVN r17662
Introduce a small amount of whitespace sensitivity into break/continue parsing
so that we don't consider an identifier on the next line to be a label.
Swift SVN r17439
As part of this, use tail allocation to reduce the memory footprint of
TupleExprs. Use factory methods to make it easier to construct.
I'll be using this information in a follow-on patch. SourceKit
probably wants it as well.
Swift SVN r17129
This implements true and false as magic constants in build configurations.
I considered adding 0 and 1 as magic integers, but true/false fit better with
our boolean centric model.
Swift SVN r16915
This restructures IfConfigDecl/Stmt to be a list of clauses controlled
by a condition. This makes it straight-forward to drop in #elseif support.
While I'm in here, this patch moves checking for extraneous stuff at the
end of the #if line from the lexer to the parser. This means that you can
now put a comment on the same line as a #if/#else/#elseif/#endif.
Swift SVN r16912
Right now you can 'break' out of a labeled switch statement, but unlabeled
break retains its previous semantics of breaking out of the nearest loop.
Swift SVN r16616
improves location information to track the label location in the AST. We
don't currently track the location of the colon, but that would be trivial
to drop in if it is interesting.
Swift SVN r16608