Commit Graph

1216 Commits

Author SHA1 Message Date
Rintaro Ishizaki
dfe962f19a Merge pull request #27508 from rintaro/syntaxparse-expridentifier
[SyntaxParse] Parse IdentifierExpr syntax
2019-10-08 19:17:46 +02:00
Rintaro Ishizaki
f42f60f233 [Syntax] Consolidate 'TupleElement' and 'FunctionCallArgument' kinds
into 'TupleExprElement'. They had exact the same layout.
2019-10-07 20:52:11 -07:00
Rintaro Ishizaki
597538ca18 [SyntaxParse] Parse IdentifierExpr syntax
Along with UnqualifiedDeclName (e.g. 'foo(x:y:)').
2019-10-02 17:06:51 -07:00
Rintaro Ishizaki
0264687b39 [SyntaxParse] Code styling 2019-10-01 15:41:40 -07:00
Nathan Hawes
f1a21348d2 [Parse] Assert that the children of syntax tree nodes have contiguous source ranges
This should help us catch syntax tree round-tripping issues.
2019-09-27 16:02:27 -07:00
Jordan Rose
8ff1dac381 [AST] Break some header dependencies for faster rebuilds (#27374)
DiagnosticEngine.h no longer depends on Attr.h.
Expr.h no longer depends on TypeRepr.h.

No functionality change.
2019-09-26 09:17:10 -07:00
Rintaro Ishizaki
b09f87594a Merge pull request #27230 from rintaro/syntaxparsse-rdar55421369
[SyntaxParse] Re-apply move-only ParsedRawSyntaxNode
2019-09-19 07:36:14 +02:00
Nathan Hawes
4dac0d1e8b Merge pull request #27218 from nathawes/r53958454-getFixedTypeRecursive-code-completion-crash
[code-completion] Remove special handling for completion on the RHS of an assignment
2019-09-18 10:49:38 -07:00
Nathan Hawes
54defbc7f7 [code-completion] Remove special handling for completion on the RHS of an assignment
This simplifies the code and prevents an assertion failure this code was
hitting computing the type relations between the result types and what it
determined as the expected type.

Resolves rdar://problem/53958454
2019-09-17 18:59:33 -07:00
Rintaro Ishizaki
9f642f0bc1 Revert "Merge pull request #27203 from CodaFi/movin-on-up"
This reverts commit 387d2a9aee, reversing
changes made to bf1ab6c29d.
2019-09-17 16:42:44 -07:00
Robert Widmann
d8aaf29617 Revert "Merge pull request #27132 from rintaro/syntaxparse-parsedrawsyntax-moveonly"
This reverts commit e675c4947d, reversing
changes made to 73315ba01e.
2019-09-16 15:10:33 -07:00
Rintaro Ishizaki
e675c4947d Merge pull request #27132 from rintaro/syntaxparse-parsedrawsyntax-moveonly
[SyntaxParse] Prevent memory leak in Syntax parsing
2019-09-14 01:06:15 +02:00
Rintaro Ishizaki
80085e0d27 [SyntaxParse] Make ParsedRawSyntaxNode move-only
So that we can easily detect 'ParsedSyntaxNode' leaking. When it's
moved, the original node become "null" node. In the destructor of
'ParsedSyntaxNode', assert the node is not "recorded" node.
2019-09-11 16:33:49 -07:00
Nathan Hawes
aa0305ee80 [Parse][IDE] Fix document structure request output for interpolated string literals
InterpolatedStringLiteralExpr has a TapExpr, which contains a BraceStmt
containing the builder CallExprs to the builder appendInterpolation /
appendStringLiteral methods used to construct the final string. This is all
implementation detail, but the BraceStmt wasn't marked implicit and had a valid
(but incorrect) SourceRange, so the document structure request treated it as
any other BraceStmt and made a structure node for it. The invalid range ended
up tripping an assertion in the document structure walker in swift-ide-test.

This patch corrects the BraceStmts produced by interpolated strings to be
marked implicit and have the correct range, and also updates ModelASTWalker to
skip over the internal details of interpolated strings when walking them (the
CallExprs were also being emitted).
2019-09-09 09:54:17 -07:00
Nathan Hawes
feb48a61b9 [code-completion] Fix correctness regressions from disabling diagnostics in code completion
There were some changes to completion results because AST mutations that were
made while diagnosing are no longer happening.

This patch 1) changes expression type checking to allow unresolved types when
solving constraint systems, so we get a solution and apply its types in more
cases, and 2) fixes a parsing issue where we would drop a ternary expression
completely if the code completion point was in its true branch.
2019-08-30 15:26:27 -07:00
Rintaro Ishizaki
cb308b7e53 Revert "Revert "[Parser] Decouple the parser from AST creation (part 2)""
This reverts commit 8ad3cc8a82.
2019-08-27 14:36:41 -07:00
Rintaro Ishizaki
8ad3cc8a82 Revert "[Parser] Decouple the parser from AST creation (part 2)" 2019-08-27 12:28:48 -07:00
Rintaro Ishizaki
1551db619e [SyntaxParse] Support kindof() in isTopNode() 2019-08-26 19:10:51 +02:00
Jan Svoboda
77924c4b84 [Parser] Decouple the parser from AST creation (part 2)
Instead of creating the AST directly in the parser (and libSyntax or
SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create
a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either
libSyntax or SwiftSyntax. If AST is needed, it can be generated from the
libSyntax tree.
2019-08-26 19:10:51 +02:00
David Ungar
35e82185e6 Back off and strategically retreat from more sensible ranges for TapExpressions and their subexpressions 2019-08-22 17:44:47 -07:00
David Ungar
a40b694801 Use token start locations 2019-08-21 22:36:15 -07:00
David Ungar
d84d541e99 De-lazify 2019-08-21 12:02:25 -07:00
David Ungar
0dbf7e6ab6 Parser changes for lazy ASTScopes 2019-08-21 09:45:45 -07:00
Owen Voorhees
686e4a600c Assign a SourceLoc to implicit appendInterpolation calls for diagnostics
This helps ensure that if, for example, a deprecated appendInterpolation is used, the resulting diag points to the opening paren of the corresponding string interpolation segment
2019-08-04 18:00:09 -07:00
Jan Svoboda
f0395a469a Revert "Revert "[Parser] Decouple the parser from AST creation (part 1)"" 2019-07-30 04:34:09 +00:00
Slava Pestov
a532a325e1 AST: Move a few methods from VarDecl down to ParamDecl 2019-07-22 20:19:09 -04:00
Suyash Srijan
1e00633ac7 [Parser] Use getLocForEndOfToken for diagnostic fix-it 2019-07-16 20:04:53 +01:00
Suyash Srijan
4feb7f6f86 [Parser] Emit fix-it in separate notes 2019-07-16 19:21:14 +01:00
Suyash Srijan
be2ac04725 [Parser] Don't call setIsParseError() 2019-07-16 19:05:03 +01:00
Suyash Srijan
59660d82fc [Diagnostics] Tweak diagnostic message slightly (replace ',' with ';' in message) 2019-07-16 19:04:14 +01:00
Suyash Srijan
f16a012492 [Parser] Dianogse use of subscript inside array literal and emit appropriate fix-its depending on whether it was expected or unexpected 2019-07-16 18:58:20 +01:00
Suyash Srijan
b839e07c12 [Parser] Adds a fix-it to convert the subscript into two arrays 2019-07-15 21:26:59 +01:00
Suyash Srijan
8092dd9ad7 [Parser] Validate a collection element if its a subscript 2019-07-15 20:59:22 +01:00
Brent Royal-Gordon
c66a8be4eb Revert "[Parser] Decouple the parser from AST creation (part 1)" 2019-07-09 14:07:43 -07:00
Jan Svoboda
5aee188716 Rename SyntaxTransformer to ASTGen 2019-07-08 17:16:35 +02:00
Jan Svoboda
44d7769238 [Parser] Decouple the parser from AST creation (part 1)
Instead of creating the AST directly in the parser (and libSyntax or
SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create
a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either
libSyntax or SwiftSyntax. If AST is needed, it can be generated from the
libSyntax tree.
2019-06-28 14:28:19 +02:00
Rintaro Ishizaki
302052cd22 [Parse] 'super' requires following l-square 2019-06-27 16:50:29 -07:00
Rintaro Ishizaki
257b61744e [CodeCompletion] Eliminate super related completion
In parser, 'parseExprPostfixSuffix()' can parse postfix expression for
'super'. 'parseExprSuper()' doesn't need to parse them.

In code-completion, 'completeExprSuper()' and 'completeExprSuperDot()'
can be consolidated to 'completePostfixExpr()' and 'completeDotExpr()'.
2019-06-26 09:59:47 -07:00
Xi Ge
2509f50e45 Syntax: introduce a token kind for single quote to preserve round-trip printing of syntax tree
For invalid code, lexer is forgiving enough to allow single quote '\'' as the starting point
of string literals. Later, parser assumes the string literals are always using double quote "\"", and passes
such knowledge to SwiftSyntax side, leading to the round-trip failure we observed in the radar.
This commit fixes the issue by introducing another token kind for single quote.

rdar://51071021
2019-06-12 17:16:16 -07:00
mishal_shah
1e38fc3030 Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs 2019-06-03 22:50:02 -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
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
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