Commit Graph

1994 Commits

Author SHA1 Message Date
Rintaro Ishizaki
dc8508435b [CodeCompletion] Show bound generic types for enum elements
We weren't displaying bound generic types for enum elements. It's
inconsistent with functions and initializiers.
2019-02-20 11:31:04 -08:00
Rintaro Ishizaki
25f9b8843c [CodeCompletion] Show the enum type for enum element with assoc values
enum MyEnum {
    case null
    case str(String)
}

When completing elements for enum like this, the former shows `MyEnum`,
but the latter shows `(String) -> MyEnum`. This is inconsistent with
function call pattern which only shows the result type.

rdar://problem/48220244
2019-02-20 10:29:59 -08:00
Rintaro Ishizaki
69ff99fbd5 Merge pull request #22717 from rintaro/ide-completion-declmemberinit-rdar48208253
[CodeCompletion] Analyze the parent of initializer
2019-02-19 17:42:13 -08:00
Rintaro Ishizaki
fd9b6a12de [CodeCompletion] Analyze the parent of initializer
For `Initializer` decl context, type context analyzer should look into
its parent context because that might constrain initializer's type.

rdar://problem/48208253
2019-02-19 14:22:24 -08:00
Xi Ge
20e27f284a Merge pull request #22700 from nkcsgexi/ide-report-types
IDE: implement an IDE action to collect types of all expressions in a source file.
2019-02-18 19:50:44 -08:00
Xi Ge
84873fbbb3 IDE: implement an IDE action to collect types of all expressions in a source file.
This is libIDE side implementation for collecting all type information in a source
file. When several expression share the same source range, we always report the
type of the outermost expression.

rdar://35199889
2019-02-18 17:53:04 -08:00
eeckstein
bf909ca11b Merge pull request #22655 from eeckstein/stack-allocated-demangler
Make the demangler in the runtime use stack allocated memory.
2019-02-18 08:56:54 -08:00
technicated
d7324b977e Added more tests
Testing SILGen & IRGen tuple keypath generation
Added tuple element type check in SILVerifier
2019-02-18 10:19:42 +01:00
Andrea Tomarelli
ede47cafbd Partial AST & Sema implementation of TKP 2019-02-18 09:04:42 +01: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
ecfce56110 Don't exclude @autoclosure from the attribute list when printing override completions 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
Erik Eckstein
58f2d373d4 Demangler: Reduce sizeof(Node) from 48 bytes to 24 bytes
This is done by disallowing nodes with children to also have index or text payloads.
In some cases those payloads were not needed anyway, because the information can be derived later.
In other cases the fix was to insert an additional child node with the index/text payload.

Also, implement single or double children as "inline" children, which avoids needing a separate node vector for children.

All this reduces the needed size for node trees by over 2x.
2019-02-15 09:29:49 -08:00
Xi Ge
c93700aa8b Address several post-commit comments. NFC 2019-02-14 22:09:32 -08:00
Rintaro Ishizaki
0bebba840e Merge pull request #22539 from rintaro/ide-codecompletion-dottype-rdar22072865
[CodeCompletion] Implement .Type completion in expression context
2019-02-12 16:03:29 -08:00
Rintaro Ishizaki
ec85151a80 [CodeCompletion] Add '.Protocol' completion for protocol in type context 2019-02-12 10:58:30 -08:00
Rintaro Ishizaki
01b8fbc1bf [CodeCompletion] Implement .Type completion in expression context
rdar://problem/22072865
2019-02-12 10:40:08 -08:00
Rintaro Ishizaki
bbf288b53f [IDE] Use 'Demangle::getTypeForMangling()' instead of 'getDeclFromMangledSymbolName()' 2019-02-08 14:43:59 -08:00
Rintaro Ishizaki
7837130ae1 [IDE] Give default implementation for completion callbacks 2019-02-08 14:09:00 -08:00
Rintaro Ishizaki
1d845d6e3f [IDE/SourceKit] New SourceKit request for filtered method list
`source.request.conformingmethods` is a new SourceKit request which
receives a source position and a list of protocol namses, returns a list
of methods whose return type conforms to the requested protocols.

rdar://problem/44699573
2019-02-08 12:56:58 -08:00
Slava Pestov
b2f0327516 IDE: Remove getTypeFromMangledSymbolname()
There was only one remaining usage other than in testing tools.

Note that when a declaration mangling was passed in, the old entry
point would (try to) return the type of the declaration.

The new entry point no longer has this behavior. I changed the
bridging-header-first test to run lldb-moduleimport-test with
-decl-from-mangled instead of -type-from-mangled-old to preserve
the behavior of the test.

Also, I removed test/DebugInfo/DumpTypeFromMangledName.swift
completely. This test only covered a handful of cases, and a bunch
of them were declaration manglings rather than type manglings.
The new tests in test/TypeDecoder/ are much more comprehensive.
2019-02-08 02:56:05 -05:00
Xi Ge
d537009ed1 Merge pull request #22365 from nkcsgexi/47777848
ASTPrinter: add an option to skip keywords with an underscore prefix
2019-02-06 16:04:50 -08:00
Xi Ge
a92ea0c256 IDE: print underscored keywords for interface generation
Addressing @airspeedswift's code review feedback.
2019-02-06 14:51:39 -08:00
Rintaro Ishizaki
d4c3ee6b49 [IDE] Handle '@unknown' attribute in syntax map
`@unknown` is so far the only attribute for statement. Handle it
specially in syntax-map.

rdar://problem/47855035 / https://bugs.swift.org/browse/SR-9873
2019-02-06 11:23:53 -08:00
Xi Ge
8dbbb2ba1d sourcekitd/format: avoid performing sibling-based indentation for PrefixUnaryExpr.
rdar://47659949
2019-01-31 15:44:19 -08:00
Rintaro Ishizaki
e7700dc67f [IDE] Fix SyntaxModel to corretly walk sequence expression correctly
* Handle sequence expression at call argument position
* Set the sequence expression as the parent when walking into its sub
  expressions.
* Correctly call walkToExprPost() to the sequence expression.

rdar://problem/47603866 / https://bugs.swift.org/browse/SR-9776
2019-01-28 11:25:07 -08:00
Marcelo Fabri
cab4968da3 [SR-9740][SourceKit] Mark types inside enum case decl as typeidentifiers 2019-01-24 09:14:11 -08:00
Xi Ge
c74cf897d7 Merge pull request #22017 from marcelofabri/rethrows
[SR-9576][SourceKit] Fix syntax type when rethrows is present
2019-01-24 08:43:52 -08:00
Marcelo Fabri
d948823d89 [SR-9576][SourceKit] Fix syntax type when rethrows is present 2019-01-22 20:26:23 -08:00
Rintaro Ishizaki
f41b694140 [IDE] Code style: space between 'override' and '{}' 2019-01-22 15:38:28 -08:00
Robert Widmann
c5b7230d22 [NFC] Upgrade EnumElementDecl to a DeclContext
Pure plumbing for the sake of default arguments.
2019-01-16 18:39:30 -05:00
Slava Pestov
e3c5eb7d3a IDE: Remove unused function 2019-01-14 14:57:03 -05:00
Rintaro Ishizaki
b446d6b051 Merge pull request #21377 from rintaro/ide-contextinfo
[SourceKit][IDE] New SourceKit request to retrieve context type information
2019-01-15 01:54:16 +09:00
Rintaro Ishizaki
54f0fab93e [IDE] Add TypeContextInfo callbacks to parser
TypeContextInfo is for new SourceKit request which receives source
location, and returns context type and members which can be referenced
by "implicit member expression" syntax.

Implement that as a code completion callbacks.
2019-01-10 17:52:37 +09:00
Rintaro Ishizaki
cc1d5c1147 [IDE] Move typeCheckContext() to ExprContextAnalysis.cpp
NFC
2019-01-10 17:52:37 +09:00
Rintaro Ishizaki
2fbd3fe682 [IDE] Move ExprContextAnalyser to its own file
NFC
2019-01-10 17:52:37 +09:00
Rintaro Ishizaki
d17bb78a0b [AST] Add shouldHideFromEditor() method
This replaces shouldHideDeclFromCompletionResults() in IDE.
2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
867c28ea74 [IDE] Rename collectArgumentExpectation() to analyzeApplyExpr()
Removed unnecessary arguments.
2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
e3387c6fdb [IDE] ExprContextAnalyzer::Analyze() doesn't need to return success 2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
758ba5e5d0 [IDE] Decouple ExprContextAnalyzer and ExprContextInfo
Just refactoring.
ExprContextInfo automatically construct analyzer and analyze().
2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
5c64324740 [IDE] Refactor ExprContextAnalyzer. NFC
We don't need to keep ExprFinder beyond analysis.
2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
2fb542537f [IDE] Rename CodeCompletionTypeContextAnalyzer to ExprContextAnalyzer
NFC
2019-01-10 17:52:36 +09:00
Rintaro Ishizaki
b033f4880c [CodeCompletion] Only analyze inner most context
Now that this passes all test cases we currently have. Stop analyzing
outer contexts because it may emit invalid context type.
2019-01-10 17:52:36 +09:00
Parker Schuh
f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00
Rintaro Ishizaki
4b39c20ace [CodeCompletion] Unresolved member completion at type parameter context
We need to map 'GenericTypeParamType' to 'ArchetypeType' to lookup its
members.

rdar://problem/46657585
2019-01-09 14:44:29 +09:00
Slava Pestov
dffa857b2a Merge pull request #21704 from slavapestov/remove-restate-filtering-consumer
Fix a crash by removing the RestateFilteringConsumer
2019-01-08 08:03:59 -05:00
Slava Pestov
c41be6ee0c IDE: Fix another usage of lookupVisibleMemberDecls() to not pass in an existential type
It's better to use the 'Self' archetype here.
2019-01-08 00:14:52 -05:00
Slava Pestov
8a201af7e6 IDE: Fix a usage of lookupVisibleMemberDecls() to not pass in an existential type
It's better to use the 'Self' archetype here.
2019-01-08 00:14:52 -05:00
Slava Pestov
f81c23d154 IDE: Replace some dead code with an assert 2019-01-08 00:14:52 -05:00