Commit Graph

47 Commits

Author SHA1 Message Date
Xi Ge
14f968a5ed SourceEntityWalker: Add a parameter to visitDeclReference() describing the kind of the reference under visit. NFC 2016-12-20 14:30:02 -08:00
practicalswift
9d0b2abfc2 [gardening] Normalize end-of-namespace comments 2016-12-17 22:29:07 +01:00
Rintaro Ishizaki
264be984b5 [AST] Eliminate NamedTypeRepr
Now that, TupleTypeRepr holds all information needed.
2016-11-26 14:17:57 +09:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Xi Ge
9577d980b0 [SourceKit] Initialize pointer as nullptr to fix a crash. rdar://28959889 2016-10-27 13:01:50 -07:00
John McCall
afdda3d107 Implement SE-0117.
One minor revision: this lifts the proposed restriction against
overriding a non-open method with an open one.  On reflection,
that was inconsistent with the existing rule permitting non-public
methods to be overridden with public ones.  The restriction on
subclassing a non-open class with an open class remains, and is
in fact consistent with the existing access rule.
2016-08-02 07:46:38 -07:00
Jordan Rose
508e825ff2 Split 'fileprivate' and 'private', but give them the same behavior.
'fileprivate' is considered a broader level of access than 'private',
but for now both of them are still available to the entire file. This
is intended as a migration aid.

One interesting fallout of the "access scope" model described in
758cf64 is that something declared 'private' at file scope is actually
treated as 'fileprivate' for diagnostic purposes. This is something
we can fix later, once the full model is in place. (It's not really
/wrong/ in that they have identical behavior, but diagnostics still
shouldn't refer to a type explicitly declared 'private' as
'fileprivate'.)

As a note, ValueDecl::getEffectiveAccess will always return 'FilePrivate'
rather than 'Private'; for purposes of optimization and code generation,
we should never try to distinguish these two cases.

This should have essentially no effect on code that's /not/ using
'fileprivate' other than altered diagnostics.

Progress on SE-0025 ('fileprivate' and 'private')
2016-07-25 13:13:35 -07:00
Xi Ge
09a19bb230 [SourceKit] Avoid expanding the last argument as trailing closure if there are other closures in the tuple. rdar://23428366 (#3408)
SourceKit invariantly expands the last argument in a function call as trailing closure,
if it is of function type. However, there are situations when inline closures
are preferred; for example, when the last argument is not the only closure in the function
call. This patch modifies SourceKit so that when the argument contains multiple closures,
the last argument is expanded as inline closure.
2016-07-07 18:25:55 -07:00
Argyrios Kyrtzidis
af21c7d4b1 [SourceKit] Move UIDsFromDeclAttributes function to SwiftLangSupport header so it can be re-used, NFC. 2016-05-05 16:44:34 -07:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Ben Langmuir
4d9c9f6098 Move SourceEntityWalker into libAST NFC
It fits right in among our other AST walkers and lets us use it lower in
the stack than libIDE.
2016-04-01 14:14:06 -07:00
John Regner
5b9fc3d832 [SourceKit] Add reformat function to libIDE
Move all the rest of the code formatters and helper classes out of the interface.
2016-03-18 21:37:00 -07:00
John Regner
e63678579b [SourceKit] Moved Formatting files into place in libIDE 2016-03-18 21:19:57 -07:00
John Regner
03339da009 [SourceKit] Renamed SwiftEditorLineRange -> LineRange
Also cleaned up whitespace
2016-03-18 21:19:55 -07:00
John Regner
0f48488c3a [SourceKit] Move LineRange and CodeFormatter to swift::ide 2016-03-18 21:18:23 -07:00
John Regner
57522ad8b5 [SourceKit] Remove Consumer from CodeFormatter.
This makes it easire to format all text, nomatter its source.
2016-03-18 20:58:21 -07:00
John Regner
377397e4af [SourceKit] CodeFormatter should know which options to apply.
CodeFormatter no longer depends on EditorDocument
2016-03-18 20:58:19 -07:00
John Regner
43cc6ffafc [SourceKit] Move to functions swift::ide namespace
Moved getTrimmedTextForLine &  getExpandedIndentForLine
This help reduce the coupling to SwiftEditor Document and allows us
to format any text, whether or not is currently in an editor doc.
2016-03-18 20:58:17 -07:00
John Regner
3283a8cc03 [SourceKit] Pass Text around more.
This helps de-couple us from the Swift Editor Document.
2016-03-18 20:51:18 -07:00
John Regner
8f728f31ad [SourceKit] Decouple SwiftEditorDocument from Formatting
Move FormatContext & FormatWalker into new file.
Move CodeFormatOptions out of SwiftEditorDocument.
Move functions getTrimmedLineOffset & getLineOffset
out of SwiftEditor Document.
Rename Offset of Line functions
Declaring that the get the offset of some line index is more clear.
2016-03-18 20:51:16 -07:00
Argyrios Kyrtzidis
345d05e2e9 Introduce an internal attribute '@_show_in_interface' to be used in stdlib for underscored protocols that
should be shown in the interface.

Also switch the option and hide all underscored protocols by default, unless they are marked with the new attribute.
2016-03-08 23:30:58 -08:00
Chris Lattner
868a795566 Introduce a new class between TypeDecl and NominalTypeDecl named GenericTypeDecl.
This factors the DeclContext and generic signature behavior out of NTD, allowing
it to be reused in the future.  NFC.
2016-03-04 23:09:15 -08:00
Dmitri Gribenko
a9f8d97d3e Replace 'unsigned int' with 'unsigned'
'unsigned' is more idiomatic in LLVM style.
2016-02-27 16:20:27 -08:00
Xi Ge
a91cc97058 [SourceKit] Indentation: aligning parameters when argument names are present. rdar://24862107
Fix is in AST by removing unnecessary override.
Originally reported by: https://twitter.com/JohnRHeaton/status/702526804138074112
2016-02-26 12:09:24 -08:00
Argyrios Kyrtzidis
10dfe5ab5a [SourceKit] Fix issue where the offset of diagnostic fixits is not updated after an edit request.
rdar://23919223
2016-02-19 19:18:44 -08:00
Xi Ge
44bf526f38 [gardening] Avoid copying source locs to a new vector, make a wrapper for token iterator. NFC 2016-02-18 15:29:40 -08:00
Xi Ge
c5408c8beb [SourceKit] Indentation: indent the first element in a collection expression according to the position of the left bracket, if they are not in the same line.
We treat this as a mutated version of sibling-based indentation, where an extra level is needed. rdar://24630624
2016-02-18 13:28:44 -08:00
Xi Ge
a2490e2ae1 [SourceKit][CodeFormat] Awake the indent-sibling test after coping with the recent updates on AST representation of parameters. 2016-02-01 14:55:20 -08:00
Xi Ge
e92fb8109f [SourceKit][CodeFormat] When indenting a getter without the leading keyword, first check if the getter is implicit. rdar://24348021 2016-02-01 11:59:27 -08:00
practicalswift
33312eac6b [gardening] Remove unreachable/unused/redundant code
* Make parameter naming in forward declaration match definition
* Remove unused argument to function persistAsync(…)
* Remove unused enum ShouldHalt
* Remove unused enum class IsProtocol
* Remove unused function dumpTypeSubstitutionMap()
* Remove unused function template getFirstPairElt(…)
* Remove unused method addConstantWordInWords(…)
* Remove unused method asExistentialTI()
* Remove unused method currentTrackedState()
* Remove unused method getNumBodyParameters()
* Remove unused method getSuccIndex()
* Remove unused method getTypeOfDeclReference(…)
* Remove unused method hasStructWithAtMostOneNonTrivialField(…)
* Remove unused method initForDirectValues()
* Remove unused method nextIfNot(…)
* Remove unused method overwriteLoweredValue(…)
* Remove unused method removeColumn(…)
* Remove unused methods HasSingleDecl() and GetFirstDecl()
* Remove unused methods overwriteLoweredExplosion(…) and setLoweredSingleValue(…)
* Remove unused methods requireRetainablePointerValue(…), getMethodSelfInstanceType(…) and isSelfArchetype(…)
* Remove unused methods setAsEmptyDirect(), setAsSingleDirectUnmanagedFragileValue(…), setAsIndirectAddress(…) and getDirectValues()
* Remove unused struct CachedMemberInfo
* Remove unused struct CallEdit
* Remove unused struct ErrorImportInfo
* Remove unused synonym ConformancePair
* Remove unused variable SemaInfo
* Remove unused variable localDeclNameNode
* Remove unused variables kindToken and kindLoc
2016-01-22 09:43:24 +01:00
Xi Ge
562de320d3 [SourceKit][CodeFormat] Indent case label items of a case statement as siblings. rdar://24279926 2016-01-21 14:01:26 -08:00
Xi Ge
a65ffab3e7 [SourceKit][CodeFormat] When indent to siblings, respect tuple elements' names. rdar://24251847 2016-01-20 10:47:52 -08:00
practicalswift
dfcece7960 Use consistent style for comment separators. 2016-01-04 01:41:33 +01:00
Chris Lattner
6afe77d597 Eliminate the Parameter type completely - now ParameterList is just
an overblown array of ParamDecl*'s that also keeps track of parenlocs
and has helper methods.
2016-01-03 14:45:38 -08:00
Chris Lattner
a30ae2bf55 Merge pull request #836 from zachpanz88/new-year
Update copyright date
2015-12-31 19:36:14 -08:00
Chris Lattner
7daaa22d93 Completely reimplement/redesign the AST representation of parameters.
Parameters (to methods, initializers, accessors, subscripts, etc) have always been represented
as Pattern's (of a particular sort), stemming from an early design direction that was abandoned.
Being built on top of patterns leads to patterns being overly complicated (e.g. tuple patterns
have to have varargs and default parameters) and make working on parameter lists complicated
and error prone.  This might have been ok in 2015, but there is no way we can live like this in
2016.

Instead of using Patterns, carve out a new ParameterList and Parameter type to represent all the
parameter specific stuff.  This simplifies many things and allows a lot of simplifications.
Unfortunately, I wasn't able to do this very incrementally, so this is a huge patch.  The good
news is that it erases a ton of code, and the technical debt that went with it.  Ignoring test
suite changes, we have:
   77 files changed, 2359 insertions(+), 3221 deletions(-)

This patch also makes a bunch of wierd things dead, but I'll sweep those out in follow-on
patches.

Fixes <rdar://problem/22846558> No code completions in Foo( when Foo has error type
Fixes <rdar://problem/24026538> Slight regression in generated header, which I filed to go with 3a23d75.

Fixes an overloading bug involving default arguments and curried functions (see the diff to
Constraints/diagnostics.swift, which we now correctly accept).

Fixes cases where problems with parameters would get emitted multiple times, e.g. in the
test/Parse/subscripting.swift testcase.

The source range for ParamDecl now includes its type, which permutes some of the IDE / SourceModel tests
(for the better, I think).

Eliminates the bogus "type annotation missing in pattern" error message when a type isn't
specified for a parameter (see test/decl/func/functions.swift).

This now consistently parenthesizes argument lists in function types, which leads to many diffs in the
SILGen tests among others.

This does break the "sibling indentation" test in SourceKit/CodeFormat/indent-sibling.swift, and
I haven't been able to figure it out.  Given that this is experimental functionality anyway,
I'm just XFAILing the test for now.  i'll look at it separately from this mongo diff.
2015-12-31 19:24:46 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Chris Lattner
feace85d5a Enhance SubscriptDecl to be a DeclContext, so it can hold its indices.
This is necessary for some other work I'm doing, which really wants
paramdecls to have reasonable declcontexts.  It is also a small step
towards generic subscripts.
2015-12-31 12:38:28 -08:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
practicalswift
fa0b339a21 Fix typos. 2015-12-26 17:51:59 +01:00
practicalswift
22e10737e2 Fix typos 2015-12-26 01:19:40 +01:00
Tysun M
faddc283be Two typo corrections for SwiftEditor.cpp
Lines 1132 and 2666. Thank you.
2015-12-09 14:25:30 -08:00
Xi Ge
ab969d14a4 [SourceKit][PlaceholderExpand] Avoid function signatures when expanding trailing closures of ()->(). rdar://21879249 2015-12-07 11:48:53 -08:00
Xi Ge
4b847abf92 [SourceKit][CodeFormat] Align the comments before a case statement with the statement. rdar://20985149 2015-11-11 11:40:49 -08:00
Xi Ge
6d19519e14 [SourceKit][CodeFormat] Adjust the indentation for getter methods that have no explicit "getter" keyword.
rdar://21598808
2015-11-06 11:34:18 -08:00
Argyrios Kyrtzidis
d19e4ae026 [SourceKit] Add license notices to all the source files. 2015-11-05 12:01:14 -08:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00