var decls. I was originally intending to use this for argument lists, but I
don't think that's a great direction to go anymore.
In any case, it seems uncontroversial to enforce immutability on foreach
enumation patterns, so I did that (see testcase)
Swift SVN r11124
are not settable (like get-only ones). Set the 'isLet' bit in various
places, but not the particularly interesting or useful places yet.
Swift SVN r11121
Also, improve error recovery for new-syntax attributes.
This means that we now compile the testcase into:
t.swift:3:16: error: unknown attribute 'xyz'
var x : () -> @xyz Int
^
t.swift:6:16: error: unknown attribute 'xyz'
func foo() -> @xyz Int {
^
instead of:
t.swift:4:15: error: expected type for function result
func foo() -> @xyz Int {
^
t.swift:4:14: error: consecutive statements on a line must be separated by ';'
func foo() -> @xyz Int {
^
;
t.swift:4:16: error: unknown attribute 'xyz'
func foo() -> @xyz Int {
^
t.swift:7:1: error: expected declaration
^
this is part of rdar://15183765
Swift SVN r9260
Parse '_' as a DiscardAssignmentExpr. Type-check it as an lvalue, and check that it only appears in the LHS of AssignExprs. During matching pattern resolution, convert it into an AnyPattern. In SILGen, when we see '_' in the LHS of an assignment, ignore the corresponding RHS rvalue.
Swift SVN r8848
Argument patterns create pseudo-named patterns, so make them implicit and ignore them when scanning for explicit source information.
Also make sure that the clang importer sets the HasSelectorStyleSignature bit appropriately.
Swift SVN r8803
Implement the new rules for mapping between selector names and
constructors. The selector for a given constructor is formed by
looking at the names of the constructor parameters:
* For the first parameter, prepend "init" to the parameter name and
uppercase the first letter of the parameter name. Append ':' if
there are > 1 parameters or the parameter has non-empty-tuple type.
* For the remaining parameters, the name of each parameter followed
by ':'.
When a parameter doesn't exist, assume that the parameter name is the
empty string.
And, because I failed to commit it separately, support selector-style
declarations of constructor parameters so that we can actually write
constructors nicely, e.g.:
// selector is initWithFoo:bar:
constructor withFoo(foo : Foo) bar(bar : Bar) { ... }
Swift SVN r8361
But the implementation of expression parsing still does not propagate the code
completion bits because it uses NullablePtr for results.
Swift SVN r7425
This finally fixes a few code completion test cases.
This also regresses the error message in one parsing testcase because
previously we would just happily skip those tokens, but now error handling path
is a little bit different and these tokens hit different error handling code.
This can be fixed by parsing a tuple for the selector argument and complaining
if the tuple had more than one element.
Swift SVN r7389
This allows the parser to recover, create an AST node, return it to the caller
*and* signal the caller that there was an error to trigger recovery in the
caller. Until now the error was signalled with a nullptr result (any non-null
result was considered a success and no recovery was done in that case).
This also allows us to signal the caller if there was a code completion token
inside the production we tried to parse to trigger delayed parsing in the
caller while doing recovery in the callee. Until now we could not do recovery
in the callee so that the caller could find the code completion token.
Right now we don't take any advantage of these features. This commit just
replaces some uses of NullablePtr with ParserResult.
Swift SVN r7332
Teach TuplePatternElt to keep track of the kind of the default
argument: none, normal (provided by calling into the appropriate
callee generator), __FILE__, __LINE__, or __COLUMN__. For the latter
three cases, the type checker forms the appropriate argument as part
of the call.
The actual default argument expression will only be held in the tuple
pattern element when we've parsed it; it won't be serialized or
deserialized, because only the defining module cares. This is a step
toward eliminate the initialization expression from tuple types.
The extension to TupleShuffleExpr is a hack, which will also be
replicated in ScalarToTupleExpr, until we finally rework the
representation of TupleShuffleExpr (<rdar://problem/12340004>).
Swift SVN r6299
The semantics of varargs (only for the last element) make it more appropriate as a property of the TuplePattern.
Also free the Parser from needing to construct synthetic types (ArraySlice for type of vararg element) to
accommodate the TypeChecker and move the logic to the TypeChecker. This will be more beneficial when the parser stops
creating types in general.
Swift SVN r6271
Per previous discussions, we only want to allow default values for
uncurried 'func' and 'constructor' parameters, and not for return
types or arbitrary tuple types. Introduce this restriction, fixing
part of <rdar://problem/13372694>.
Swift SVN r6156
This the first part for improving source location fidelity for types,
changes to follow:
-The Parser will not create any types, it will just create TypeReprs.
-The type checker will create the types by going through TypeReprs.
-IdentifierType will be removed.
Swift SVN r6112