Commit Graph

1645 Commits

Author SHA1 Message Date
Slava Pestov
7913d30236 Sema: Use a request to compute FuncDecl::getSelfAccessKind() 2019-06-19 14:38:43 -04:00
Slava Pestov
25570d9f05 Merge pull request #25588 from slavapestov/remove-parser-implicit-accessors
Stop synthesizing accessors inside the parser
2019-06-19 14:12:13 -04:00
Rintaro Ishizaki
e52feac6d0 Merge pull request #25565 from owenv/unnamed_static_var_diag
[Diagnostics]: Fix broken diagnostic for unnamed static class property
2019-06-19 09:44:32 -07:00
Slava Pestov
ea84da3fad Parse: Stop synthesizing implicit getters and setters
Sema is now capable of synthesizing accessors for local properties,
and SILGen can emit them, so we can remove this codepath altogether.
2019-06-18 18:38:38 -04:00
Owen Voorhees
89d4e6378d [Diagnostics]: Fix broken diagnostic for unnamed static class property 2019-06-16 19:35:17 -07:00
Doug Gregor
2e8d9a4331 [SE-0258] Adopt @propertyWrapper everywhere. 2019-06-12 13:09:40 -07:00
Rintaro Ishizaki
04ca9752cf [CodeCompletion] Enable type name completion for param decl attribute
rdar://problem/50074177
2019-06-11 17:34:45 -07:00
Rintaro Ishizaki
b31c142efb [CodeCompletion] Implement completion at custom attribute argument 2019-06-11 17:34:44 -07:00
Rintaro Ishizaki
62193c961e [CodeCompletion] Enable type completion at beginning of attribute
for 'VarDecl' or if we don't know the kind of the decl.
Property delegate allows arbitrary type name (with `@propertyDelegate`
attr).
2019-06-11 17:34:44 -07:00
Rintaro Ishizaki
9ba232d718 [CodeCompletion] Implement completion at custom attribute argument 2019-05-31 11:09:54 -07:00
Rintaro Ishizaki
878c9c600b [CodeCompletion] Enable type completion at beginning of attribute
for 'VarDecl' or if we don't know the kind of the decl.
Property delegate allows arbitrary type name (with `@propertyDelegate`
attr).
2019-05-31 09:44:19 -07:00
Nate Chandler
1267f659c6 Address PR comments on return omission. 2019-05-07 14:20:21 -07:00
Xi Ge
24f5ba741a Syntax: add Syntax support for property delegate attributes
rdar://50056605
2019-05-02 09:50:40 -07:00
Ben Langmuir
81ce653bc3 Merge pull request #23587 from benlangmuir/cc-omit-return
[code-completion] Add type context for single-expression function bodies
2019-04-25 13:49:45 -07:00
nate-chandler
155a155000 Merge pull request #23251 from nate-chandler/nate/omit-return
Allow return to be omitted from single expression functions.
2019-04-25 08:36:34 -07:00
Nate Chandler
f8ef213475 Corrected off-by-one error. 2019-04-24 10:09:19 -07:00
Nate Chandler
a09a9640d0 Don't implicitly return assignments.
Corrected a number of diagnostic regressions.
2019-04-24 10:09:19 -07:00
Nate Chandler
0b528ae9f5 Don't add an implicit () after return for initializers. 2019-04-24 10:04:20 -07:00
Nate Chandler
ac7a76c02d Don't insert return during code completion. 2019-04-24 09:59:53 -07:00
Nate Chandler
08bbce336f Addressed issues from PR review.
- preferred dyn_cast to is and get
- restored insertion of () on bare return statements
- used dyn_cast not dyn_cast_or_null when the argument is non-null
- used getSingleExpressionBody accessor during second AST modification
- eliminated erroneous access through null reference
2019-04-24 09:59:53 -07:00
Nate Chandler
74b462b3ba WIP: Allow return to be omitted from single expression functions. 2019-04-24 09:59:53 -07:00
Doug Gregor
56d450b595 [Property delegates] Contextualize direct initializers of custom attributes
When a custom attribute is given a direct initializer, save and re-use
the initializer context we create so that it can be associated with the
enclosing pattern binding. Fixes assertions involving explicit closures
in property delegates.
2019-04-23 11:32:29 -07:00
Doug Gregor
32b0245187 [Parser] Consistently use consumeIdentifier() for normal identifiers.
consumeIdentifier() provides the general way in which we consume an
identifier token and fill in an Identifier. Use it consistently in the
parser.
2019-04-23 11:31:58 -07:00
Doug Gregor
9c62420809 [AST] Generalize PatternBindingEntry's "Lazy" flag to "Subsumed"
The initializer associated with a lazy property should not be executed
directly, because it is subsumed by code synthesized into the
getter. Generalize the terminology here so we can re-use this path for
property delegate initialization.
2019-04-23 11:31:58 -07:00
Rintaro Ishizaki
7078862921 [CodeCompletion] Provide 'some' keyword where applicable
rdar://problem/49353647
2019-04-19 17:11:16 -07:00
Joe Groff
dbd3a48afb Track var/subscript opaque return decls for type reconstruction. 2019-04-17 14:46:22 -07:00
Joe Groff
399332b75b Parsable interface and type reconstruction support for opaque types.
When printing a swiftinterface, represent opaque result types using an attribute that refers to
the mangled name of the defining decl for the opaque type. To turn this back into a reference
to the right decl's implicit OpaqueTypeDecl, use type reconstruction. Since type reconstruction
doesn't normally concern itself with non-type decls, set up a lookup table in SourceFiles and
ModuleFiles to let us handle the mapping from mangled name to opaque type decl in type
reconstruction.

(Since we're invoking type reconstruction during type checking, when the module hasn't yet been
fully validated, we need to plumb a LazyResolver into the ASTBuilder in an unsightly way. Maybe
there's a better way to do this... Longer term, at least, this surface design gives space for
doing things more the right way--a more request-ified decl validator ought to be able to naturally
lazily service this request without the LazyResolver reference, and if type reconstruction in
the future learns how to reconstruct non-type decls, then the lookup tables can go away.)
2019-04-17 14:46:22 -07:00
Joe Groff
be0140fe56 Switch __opaque to some, per the latest rev of the proposal 2019-04-17 14:46:21 -07:00
Joe Groff
5e1497967a Parse opaque types. 2019-04-17 14:43:32 -07:00
Robert Widmann
f6244302ef Merge pull request #24034 from kitasuke/remove_deprecated_decl_attributes_support
[Gardening] Remove deprecated decl attributes support
2019-04-16 11:19:41 -04:00
kitasuke
d35cbee083 Fix a comment for spell check of available 2019-04-16 12:19:36 +09:00
swift-ci
a2d932daaf Merge pull request #24050 from nkcsgexi/synthesize-r-brace 2019-04-15 18:50:08 -07:00
Xi Ge
746a88aec8 Syntax: synthesize right brace tokens if they are missing from nominal type decls. 2019-04-15 16:45:26 -07:00
kitasuke
543ddbceee Remove NSKeyedArchiver family support for decl attributes 2019-04-15 17:33:51 +09:00
Rintaro Ishizaki
9347328bfe Merge pull request #23961 from AnthonyLatsis/associativity-kind-coloring
Parse: Reinterpret associativity kinds as contextual keywords
2019-04-12 14:10:39 -07:00
fischertony
44dfba81e4 Parse: Reinterpret associativity kinds as contextual keywords 2019-04-11 21:27:39 +03:00
Brent Royal-Gordon
d9732a050f Allow the declaration of static subscripts
In this commit, MyStruct.self[0] parses and typechecks but the solution doesn’t apply correctly. MyStruct[0] gets diagnosed as an error.
2019-04-10 23:09:44 -07:00
Slava Pestov
003a9a47b2 Parse: Remove obsolete @autoclosure(escaping) and @noescape type attributes
Some diagnostics got worse, but I think the reduction in compiler complexity
is worth it, and copy-and-pasting Swift 2 code is not likely to produce great
results anyway.

Also, this corrects an oversight where we did not reject @pseudogeneric on
function types in AST parsing.
2019-04-09 15:02:14 -04:00
Slava Pestov
6bb36b5c01 Sema: Subscript default arguments
Fixes <https://bugs.swift.org/browse/SR-6118>.
2019-04-02 20:37:01 -04:00
Brent Royal-Gordon
972eda2316 [NFC] AST-level support for static subscripts
* Moves the IsStatic flag from VarDecl to AbstractStorageDecl.
* Adds a StaticSubscriptKind to SubscriptDecl.
* Updates serialization for these changes.
* Updates SubscriptDecl constructor call sites for these changes.
2019-04-01 18:04:00 -07:00
Doug Gregor
a848d12665 Parse unknown attributes as "custom" attributes.
Parse custom attributes with the grammar:

```
'@' type-identifier expr-paren?
```
2019-03-29 23:10:36 -07:00
Ben Langmuir
e255bac6be [code-completion] Fix type context for single-expression implicit getter
This adds an implicit body so that we can dig out the return type
context the same way as a normal function. For now, we are also treating
the first expression in a multi-statement implicit getter body the same
way; we'll need to refactor how we complete in accessors to
differentiate those cases.
2019-03-26 16:45:32 -07:00
Rintaro Ishizaki
1038011c67 [CodeCompletion] Force type check pattern binding for initializer
Also, do not handle parsed decls in first-pass. Because they are
re-parsed, they used to case duplicated decls in AST.

rdar://problem/40944761
2019-03-08 13:42:08 -08:00
fischertony
ae415b2a4b When followed by an 'override' or CC token inside a class, treat 'class' as a modifier rather than an introducer. 2019-02-16 16:02:22 +03:00
fischertony
86d9d7a6b5 Fix override completions when a valid introducer is present but the override keyword is not. 2019-02-16 16:02:22 +03:00
fischertony
bb9482bab5 [CodeCompletion][Parser] Completions for overridable static members 2019-02-16 16:02:06 +03:00
Robert Widmann
944d8d06d7 [SE-0155] Default Arguments in Enum Cases
The bulk of the changes are to SILGenApply.  As we must now evaluate the
payload ArgumentSource to an RValue, we follow the example of subscripts
and lie to the argument emitter.  This evaluates arguments at +1 which
can lead to slightly worse codegen at -Onone.
2019-02-12 10:06:48 -05:00
Slava Pestov
d41eec9510 Parse: Simplify Parser::canDelayMemberDeclParsing() 2019-01-18 00:15:53 -05:00
Slava Pestov
93c386d263 Parse: Skip function bodies when delayed member parsing mode is on
Fixes <rdar://problem/47305142>.
2019-01-18 00:15:53 -05:00
Slava Pestov
fb0fbc099b Parse: Rename DisableDelayedParsing to DelayBodyParsing and change polarity 2019-01-18 00:15:41 -05:00