Commit Graph

4242 Commits

Author SHA1 Message Date
David Ungar
80ccbcf291 Simpler trailing angle bracket. 2019-05-29 13:02:42 -07:00
David Ungar
663760e3b7 ASTOOScope ontology 2019-05-28 10:48:22 -07:00
Rintaro Ishizaki
6c0806419f Merge pull request #25008 from owenv/improved_#else_if_diagnostic
[Parse] Improve diagnostic and add fixit to correct '#else if' to '#elseif'
2019-05-24 09:38:12 -07:00
Owen Voorhees
901d947478 Improve diagnostic and add fixit to correct '#else if' to 'elseif'
Resolves SR-10581
2019-05-23 19:34:21 -07:00
David Ungar
6cf09fa9bb Merge pull request #24905 from davidungar/interpolated-string-literal-trailing-quote-loc
[NameLookup: ASTScope] Add trailing quote location to interpolated string literal.
2019-05-20 12:57:44 -07:00
Xi Ge
d05a7481a8 Merge pull request #24850 from nkcsgexi/syntax-tree-with-condition
Parser: avoid skipping inactive code if we are building syntax trees.
2019-05-20 12:01:23 -07:00
David Ungar
92fd649b92 Use CloseQuoteBegin 2019-05-20 10:41:47 -07:00
David Ungar
7a8b3c8383 Add trailing quote location to interpolated string literal. 2019-05-19 15:26:34 -07:00
Rintaro Ishizaki
1b688d5e21 [CodeCompletion] Implement call signature completion for subscript
rdar://problem/28874899
2019-05-17 14:20:28 -07:00
Xi Ge
f25925fc84 Parser: suppress diagnostics when parsing inside inactive code 2019-05-17 12:36:34 -07:00
Xi Ge
c8dd6a9ba1 Parser: avoid skipping inactive code if we are building syntax trees.
If syntax trees are requested, we shouldn't skip inactive code. Notice the
inactive code won't be skipped in SwiftSyntax because we always set
PerformConditionEvaluation false for the in-process parser.

This is mostly needed for testing purposes where we add -verify-syntax-tree
to regular compiler invocations.

rdar://50837165
2019-05-17 12:32:10 -07:00
Rintaro Ishizaki
1e711850bb Merge pull request #24805 from rintaro/ide-completion-unresolvedarg-rdar50696432
[CodeCompletion] Call argument completion for implicit member expression
2019-05-15 18:49:14 -07:00
Rintaro Ishizaki
5b5d342995 [CodeCompletion] Enable call signature completion for unresolved member
rdar://problem/50696432
2019-05-15 17:31:19 -07:00
Jan Svoboda
b0f6168660 [libSyntax] Represent raw string delimiters 2019-05-15 09:15:03 +02:00
Brent Royal-Gordon
82928fd821 Merge pull request #24464 from brentdax/charmed-interpolations
[Parse][Sema] Improve interpolation parsing and construction
2019-05-14 17:49:46 -07:00
Rintaro Ishizaki
0283e4dbcb Merge pull request #24718 from kitasuke/SR-10241_string_literal
SR-10241 Consolidate StringInterpolationExpr to StringLiteralExpr in Syntax
2019-05-14 08:25:32 -07:00
kitasuke
e09a34129a Consume toke for string literal expr in a better way
Fix incorrect indent
2019-05-14 08:52:42 +09:00
kitasuke
b3a4ab6744 Revert removal of invalid interpolation check 2019-05-14 00:33:28 +09:00
kitasuke
a7d33aa751 Fix to make minimum AST nodes for StringLiteralExpr 2019-05-14 00:32:58 +09:00
kitasuke
9155ed88e0 Use StringLiteralExpr for invalid InterpolatedStringLiteralExpr 2019-05-12 11:23:16 +09:00
kitasuke
ef413e491c Use StringLiteralExpr node if it's a single literal segment 2019-05-12 11:23:08 +09:00
kitasuke
b583fef8e2 Consolidate StringInterpolationExpr to StringLiteralExpr 2019-05-12 11:23:00 +09:00
Brent Royal-Gordon
4f1e05cbeb [AST] Give appendInterpolation refs a SourceLoc
This change permits UnresolvedDotExpr to have both a name and a base that are implicit, but a valid DotLoc, and to treat that DotLoc as the node’s location. It then changes the generation of string interpolation code so that `$stringInterpolation.appendInterpolation` references have a DotLoc corresponding to the backslash in the string literal.

This makes it possible for `ExprContextAnalyzer` in IDE to correctly detect when you are code-completing in a string interpolation and treat it as an `appendInterpolation` call.
2019-05-09 15:29:21 -07:00
Brent Royal-Gordon
da74978a8d [Parse] Parse string interpolations as args
Now that we manipulate the argument list to correct strange interpolations in Sema, we can parse interpolations directly as argument lists, simplifying the parser.

By itself, this refactoring causes a code completion regression; a subsequent commit will fix that.
2019-05-09 15:29:21 -07:00
Brent Royal-Gordon
a4e5bcea6a Move strange interpolation fix to PreCheckExpression
This defers diagnosis until a stage where #if conditions have definitely been evaluated, at the cost of a slightly more complex implementation. We’ll gain some of that complexity back in a subsequent refactoring. Fixes SR-9937.
2019-05-09 15:29:21 -07:00
Nate Chandler
1267f659c6 Address PR comments on return omission. 2019-05-07 14:20:21 -07:00
kitasuke
5debb929da Rename StringInterpolationSegments to StringLiteralSegments 2019-05-06 09:37:37 +08:00
Xi Ge
24f5ba741a Syntax: add Syntax support for property delegate attributes
rdar://50056605
2019-05-02 09:50:40 -07:00
kitasuke
94815fae26 Revert "Revert "SR-10469 Unknown syntax for interpolated string literal""
This reverts commit 18dd11ab21.
2019-04-30 22:35:29 +01:00
Mishal Shah
18dd11ab21 Revert "SR-10469 Unknown syntax for interpolated string literal" 2019-04-29 23:09:58 -07:00
Rintaro Ishizaki
9b6ba43de6 Merge pull request #24280 from kitasuke/SR-10469-func-call-args_list
SR-10469 Unknown syntax for interpolated string literal
2019-04-29 17:34:45 -07:00
Sam Lazarus
3d9b6396a1 Merge pull request #24059 from sl/sl/sr-10293
Allow var / let as parameter names but provide a warning and fixit to add backticks.
2019-04-26 09:30:23 -04:00
Sam Lazarus
ede8127adf Test: Add and update tests for allowing var and let as argument labels 2019-04-26 04:08:27 -04:00
Sam Lazarus
2a38b48eea Parse / AST: Allow let / var as argument labels with a warning.
The diagnostic is now a warning and the new message alerts the user that
though it is valid to have let and var as argument label names,
they are interpreted as argument labels, not keywords.
2019-04-26 04:08:01 -04:00
kitasuke
81ed9cc2f9 Merge branch 'master' into SR-10469-func-call-args_list 2019-04-26 06:29:02 +02: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
7f293f66b3 [Parser] Allow use of $ declarations in all modes.
Allow the use of declarations whose names start with $ in all
modes. However, normal code cannot define new entities with names that
start with $: only the implementation can do that, e.g., for property
delegates.
2019-04-23 11:31:58 -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
kitasuke
abd6dcfece Change expression kind from Expr to FunctionCallArgumentList 2019-04-23 17:54:26 +09:00
Rintaro Ishizaki
73d3fd6631 Merge pull request #24177 from rintaro/sourcekit-opaque-result-types
[SourceKit] SourceKit support for opaque result types
2019-04-22 09:58:47 -07:00
Xi Ge
a9ba1ced6c Merge pull request #24176 from nkcsgexi/syntax-disambiguity
Syntax: use child name instead of type name for gyb-generated functions. NFC
2019-04-19 19:27:30 -07:00