Commit Graph

2321 Commits

Author SHA1 Message Date
Xi Ge
2d22a375f7 Merge pull request #24986 from nkcsgexi/object-literal-syntax
SourceKit/SyntaxMap: properly handle object literal syntax for highlighting
2019-05-22 19:29:17 -07:00
Xi Ge
d3a192f3c5 SourceKit/SyntaxMap: properly handle object literal syntax for highlighting
We should use parser to figure out the end position of object literal expression instead
of scanning through token stream, which crashes sourcekitd when the syntax is invalid.

Fixing: rdar://48390913
2019-05-22 14:29:57 -07:00
Rintaro Ishizaki
a79fadcdce Merge pull request #24969 from rintaro/ide-completion-poundfile-rdar47169238
[CodeCompletion] '#file', '#line', et al. after '#'
2019-05-22 10:12:55 -07:00
Rintaro Ishizaki
c0014838ca [CodeCompletion] Added test case for polymorphic type keywords 2019-05-21 17:25:53 -07:00
Rintaro Ishizaki
e2a4621b14 [CodeCompletion] Suggest #selector and #keyPath after # only if applicable
Also, add type annotation, and make it `TypeRelation[Identical]`.
'ExprSpecific' is too strong.
2019-05-21 17:25:53 -07:00
Rintaro Ishizaki
83084e2b5f [CodeCompletion] Suggest 'file', 'line', et al. after #
rdar://problem/47169238
2019-05-21 17:24:59 -07:00
Marc Rasi
fb268e5234 handle diags that happen during repl code completion 2019-05-20 11:10:44 -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
e9e5134c32 [CodeCompletion] Add test cases for call arg completion
Static methods, implicit member.
2019-05-15 17:31:19 -07: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
Ben Langmuir
e9384bb351 Merge pull request #24540 from benlangmuir/cc-nested-keypath
[code-completion] Handle nested keypath dynamic lookup correctly
2019-05-14 13:30:48 -07:00
Ben Langmuir
636d63e609 [code-completion] Handle nested keypath dynamic lookup correctly
If the root type of the KeyPath also has dynamic member lookup, we need
to look through it.

rdar://problem/50450037
2019-05-13 14:32:33 -07:00
Rintaro Ishizaki
663defab4a [SourceKit] Add InterfaceGen test case for pure Swift system module
rdar://problem/50458412
(Reapply - Forgot to add `-target` in SourceKit test in previous change.)
2019-05-13 10:55:23 -07:00
Rintaro Ishizaki
7b7c320bd5 [CodeCompletion] Allow ErrorType in constructor
Even if the constructor has `ErrorType` we can suggest it as long as it's
`FunctionType`.

rdar://problem/49480808
2019-05-13 01:32:57 -07:00
Rintaro Ishizaki
4cb7d27eba Revert "[SourceKit] Add InterfaceGen test case for pure Swift system module" 2019-05-10 18:35:34 -07:00
Rintaro Ishizaki
6c8641b9b1 [SourceKit] Add InterfaceGen test case for pure Swift system module
rdar://problem/50458412
2019-05-10 10:12:24 -07: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
Rintaro Ishizaki
d3d30ee246 [Serialization] Support Swift only system module
Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
2019-05-08 17:03:06 -07:00
Rintaro Ishizaki
ffde2280c9 [CodeCompletion] Hide 'SwiftOnoneSupport' from module name completion 2019-05-08 10:12:29 -07:00
Rintaro Ishizaki
502f5302c2 [test] Add test cases for Swift module completion after 'import' 2019-05-08 10:11:52 -07:00
Ben Langmuir
6c29502bc8 Fix test comment about expected behaviour 2019-05-06 13:13:04 -07:00
Ben Langmuir
8f38e4b765 [code-completion] Avoid invalid member substitution for keypath dynamic lookup
When performing keypath dynamic member lookup, avoid substituting the
base type in override detection and completion, as the base type of the
lookup is not the base type of the member. For now, we just avoid the
substitution entirely to fix potential crashes; in a future commit we
will change to using the subscript return type and substituting with the
base type of the subscript instead of the base type of the lookup.

rdar://50449788
2019-05-06 10:02:39 -07:00
Doug Gregor
6933382ac5 [Property delegates] Fix default argument printing with default initialization 2019-05-02 15:14:39 -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
Rintaro Ishizaki
6126665769 [ASTPrinter] Print opaque type using ArchetypeType::getExistentialType()
Previously, it did't take super class constraint into account.

rdar://problem/50113513
2019-04-26 11:14:27 -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
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
kitasuke
cb1c6c595d Mark failed test as RUN-FIXME temporally 2019-04-25 21:45:08 +02:00
Doug Gregor
0c26e4349e Underscore the @propertyDelegate attribute to indicate that it's experimental 2019-04-24 21:25:33 -07:00
Doug Gregor
7df695536e [Property delegates] Fix printing of memberwise initializer default arguments 2019-04-23 11:32:28 -07:00
Doug Gregor
f9c716df87 Add support for the @propertyDelegate attribute.
Add the @propertyDelegate attribute, enforcing all of the semantic
requirements that are placed on property delegate types.
2019-04-23 11:31:58 -07:00
Slava Pestov
5cb1c6aa88 Merge pull request #24196 from AnthonyLatsis/diag-proto-multiple-superclass
Diag: Correct message for protocols with multiple superclass requirements
2019-04-22 20:58:05 -04:00
Rintaro Ishizaki
502a7bf3d7 Merge pull request #24180 from rintaro/ide-completion-static-subscript-rdar49131687
[CodeCompletion] Completion support for static subscript
2019-04-22 09:59:07 -07:00
fischertony
70f8c84af7 Diag: Correct message for protocols with multiple superclass requirements 2019-04-21 17:04:31 +03:00
Rintaro Ishizaki
6e0b8c2b67 [CodeCompletion] Completion support for static subscript
rdar://problem/49131687
2019-04-19 21:36:17 -07:00
Rintaro Ishizaki
1b7d3e4be1 [CodeCompletion] Add test case for postfix expression for opaque types
rdar://problem/49354663
2019-04-19 17:34:08 -07:00
Rintaro Ishizaki
3a2454c2c7 [CodeCompletion] Use opaque type for override completion if preferable
rdar://problem/49354106
2019-04-19 17:34:08 -07:00
Rintaro Ishizaki
7078862921 [CodeCompletion] Provide 'some' keyword where applicable
rdar://problem/49353647
2019-04-19 17:11:16 -07:00
Xi Ge
6743b6103b IDE: treat some as keyword for opaque result type 2019-04-19 17:11:03 -07:00
Ben Langmuir
ae4827a437 [code-completion] Avoid name copy for non dynamic member types
Per review feedback. Also add some test cases that should fail dynamic
member lookup.
2019-04-17 09:50:24 -07:00
Ben Langmuir
8d4447c1d7 [code-completion] Add completion for keypath dynamic member lookup
Looks into the root type of the keypath to find additional members. This
does not currently map the type of the completion to the subscript's
return type.

rdar://49029126
2019-04-16 15:37:32 -07:00
Ben Langmuir
effab8c522 Handle dynamic member lookup in annotation and cursor info
Ensure the various entity walkers handle the implicit subscript
reference correctly (usually by ignoring it) and fall through to the
underlying declarations.

rdar://49028895
2019-04-16 15:37:32 -07:00
Slava Pestov
39a22f3d6a AST: Remove ParameterTypeFlags::Escaping
Escapingness is a property of the type of a value, not a property of a function
parameter. Having it as a separate parameter flag just meant one more piece of
state that could get out of sync and cause weird problems.

Instead, always look at the noescape bit in a function type as the canonical
source of truth.

This does mean that '@escaping' is now printed in a few diagnostics where it was
not printed before; we can investigate these as separate issues, but it is
correct to print it there because the function types in question are, in fact,
escaping.

Fixes <https://bugs.swift.org/browse/SR-10256>, <rdar://problem/49522774>.
2019-04-15 00:25:03 -04: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