Commit Graph

900 Commits

Author SHA1 Message Date
Max Moiseev
885b564bf5 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 17:16:37 -08:00
Ben Langmuir
0bc2cc4290 [CodeCompletion] Negate incorrect comment NFC 2016-03-09 16:20:24 -08:00
Ben Langmuir
4a30637e08 [CodeCompletion] Don't complete unavailable methods in override
We generally don't want to override unavailable methods.  We already
filter out unavailable decls when completing values, but that's in a
separate visible decl consumer.

rdar://problem/25058233
2016-03-09 16:20:23 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Leo Giertz
70816b7cf8 Just include <cstdarg> unconditionally 2016-03-09 19:49:15 +01:00
Leo Giertz
9787a72288 [FreeBSD] Include <stdarg.h>, needed for va_start etc. 2016-03-09 17:11:01 +01:00
Ben Langmuir
d03539c127 [ReconstructType] Run clang-format on this file
I wouldn't normally do a bulk reformat like this, but in this case I
think the benefits of consistently formatting the file outweigh the
costs, because (a) there is no substantive history to this file yet in
the swift repo, and (b) there are widespread and *distracting* style
differences like brace-placement and spaces before opening (.
2016-03-08 22:03:28 -08:00
Ben Langmuir
1af03871dc [ReconstructType] Remove a call to printf 2016-03-08 22:03:27 -08:00
Ben Langmuir
43f078eaf2 [ReconstructType] Remove an unnecessary typedef NFC
Eventually all three of these should go away.  I want to keep
ConstString around for now, because it makes it easier to audit where
you should consider using a StringRef. I'm hoping only a few of those
actually need std::string.
2016-03-08 22:03:27 -08:00
Ben Langmuir
acbebfacb3 [ReconstructType] Drop unnecessary llvm:: qualifications NFC
Behold the power of LLVM.h
2016-03-08 22:03:26 -08:00
Ben Langmuir
da00713bd8 [ReconstructType] Don't explicitly qualify swift:: NFC
Now it feels more like home.
2016-03-08 22:03:25 -08:00
Ben Langmuir
46c6dd5a34 [ReconstructType] Rename an unfortunate enum 'Type' NFC
Preparing to drop swift:: everywhere.
2016-03-08 22:03:25 -08:00
Ben Langmuir
fb223fc187 [ReconstructType] Reorder and prune includes
No promise that this is minimal or optimal.
2016-03-08 22:03:24 -08:00
Xi Ge
09cd9c1f9d ModulePrinting: Fix several issues pointed by Ben. 2016-03-08 18:34:38 -08:00
Max Moiseev
1fae0d1325 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-08 12:48:48 -08:00
Xi Ge
fb05179ed7 ModuelPrinter: Add delineator to mark Decls from a different source file start. 2016-03-08 12:18:10 -08:00
Xi Ge
e674e986a2 ModulePrinting: Print stdlib Decls from the same source file in source order. 2016-03-08 12:18:10 -08:00
Xi Ge
7a3276738b Re-apply "ModulePrinter: Print decls from the same source file near each other."
This reverts commit 1db83907e3.
2016-03-08 12:18:10 -08:00
Ben Langmuir
ce3c2de4a6 [CodeCompletion] Convert optionals when checking for literal protocol conformance
Except for nil literals, we don't want to look at the optional itself,
since the typechecker would implicitly look to the underlying type.

rdar://problem/24707210
2016-03-08 09:39:04 -08:00
Xi Ge
1db83907e3 Revert "ModulePrinter: Print decls from the same source file near each other."
This reverts commit a5c9072344 for mysterious bot test failure.
2016-03-07 23:33:23 -08:00
Xi Ge
a5c9072344 ModulePrinter: Print decls from the same source file near each other. 2016-03-07 22:51:50 -08:00
Ben Langmuir
09754f21cd [CodeCompletion] Don't add type-relation for SequenceType protocol in loop
We don't want to prioritize the type name for protocols, since they
can't be used (generally) to construct an instance of the type. Ideally
we would prioritize types that conform to the protocol.

For rdar://problem/24873625
2016-03-07 22:22:18 -08:00
Chris Lattner
fe9fe47b7e Implement support for generic typealiases. 2016-03-07 22:20:16 -08:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Chris Lattner
67f964ab2e simplify and generalize a declaration, NFC. 2016-03-06 21:20:29 -08:00
Xi Ge
40f0c7c1f3 ModulePrinting: Save some copies by passing function pointer. NFC 2016-03-05 12:29:01 -08:00
Ben Langmuir
f61a241dfc [ASTPrinter] Rename parameter callback to widen scope NFC
I want to start using this for other things like function types and
attributes, so rename it to reflect the new scope. I'm not really happy
with "PrintStructureKind", etc. but haven't come up with anything
better so far.
2016-03-03 18:39:20 -08:00
Xi Ge
8bde763ba2 IDETypeChecking: make parameter consistently pass reference. NFC 2016-03-03 18:02:13 -08:00
Xi Ge
326514e397 ModulePrinting: when printing synthesized extensions, avoid printing requirements that are known to be true. 2016-03-03 17:42:35 -08:00
Max Moiseev
cf4bafe9e3 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-03 13:22:03 -08:00
Ben Langmuir
1182e41e01 [SourceKit] Add tags for generic parameters to annotated decl
Like typerefs, we want to show the USR in the tag.

rdar://problem/24292226
2016-03-03 12:47:09 -08:00
Xi Ge
167bf02206 Type Re-constructor: Fix a crasher for LLDB. Patch and commit message from Greg Clayton.
Code like this:

public struct MyStruct {
   private typealias IntegerType = Int
   private func Foo(i : IntegerType)
   {
       var a = Dictionary<String, IntegerType>()
       a["hello"] = 123
       print("a = \(a)")
       print("i = \(i)")
       print("done");
   }
}
func main() {
   let s = MyStruct();
   s.Foo(123)
}

main()

Will crash if we set a breakpoint on the 'print("done")' line and expand the "a" variable due to the IntegerType not
making it into the Swift module since it is private. Then we try to create the Dictionary generic type with type
list that has only "String" in it and boom.
2016-03-02 18:22:32 -08:00
Ben Langmuir
8f9299cc97 [CodeCompletion] Add assignment to experimental operator completion
When the LHS is an lvalue/assignable tuple and there is no leading
sequence of binary expressions.

It's a bit hacky right now since we don't have a good way to
differentiate general pattern completions from builtin operators.

rdar://problem/23209683
2016-03-02 18:21:37 -08:00
Xi Ge
3f20eb242d Refactoring: Moving the logic of collecting synthesized extensions to Analyzer. NFC. 2016-03-02 17:30:11 -08:00
Ben Langmuir
1b22116639 [SourceKit] Refactor parameter printing to use its own callbacks NFC
The current approach of visiting the param decl won't work when we want
to visit the parameters of function *types*, or when visiting tuple
elements (which aren't themselves decls).

rdar://problem/24292226
2016-03-02 11:01:11 -08:00
Xi Ge
9c2f28475e [SyntaxColoring] Highlight doc comment keywords in playground-specific doc comment format. rdar://24870642 2016-03-01 15:44:41 -08:00
Xi Ge
60be59953a ModulePrinting: Add the basic infrastructure to remove inapplicable synthesized extensions.
As the initial step, we remove any synthesized extensions requiring a tuple's conforming to nominals, which
never happens. This will remove multiple useless synthesized extensions for Dictionary.
2016-03-01 15:44:41 -08:00
Max Moiseev
859db53d87 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-01 12:56:26 -08:00
Ben Langmuir
f0d306eb10 [ASTPrinter] Enforce pairing of pre/post decl callbacks
We can have multiple printDeclPre callbacks pending (e.g top-level-code
decls), so use a vector to ensure we don't lose the earlier callbacks.

We also may end up calling printDeclPost without forcing the
corresponding printDeclPre first if the decl doesn't actually print
anything (e.g. an if-config statement when skipping those). So add a
wrapper callPrintDeclPost that can check for this and skip both
callbacks.  In theory, we could handle this case by instead making all
ast nodes go through something like shouldPrint() and making an
invariant that something will be printed if and only if shouldPrint
returns true.  However, that is not an obvious win, because it forces us
to walk all the first-level statements and decls inside a top-level-code
decl to determine if anything will be printed, and it also means we can
never make local decisions about whether something will be printed.  For
now, I've chosen to maintain flexibility by recovering from unprinted
decls.

Finally, add a bunch of assertions to try to keep callbacks sane.
2016-02-29 14:59:58 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
practicalswift
34188788a1 [gardening] Sort file listings in CMakeLists.txt files 2016-02-27 19:50:30 +01:00
Max Moiseev
488b464f10 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-25 12:21:56 -08:00
Ben Langmuir
86bc29cfc6 [SourceKit] Add type tags for parameters and return types
When the type is not just a reference to a nominal type, we still need
to be able to delineate it.

rdar://problem/24292226
2016-02-25 09:07:16 -08:00
Ben Langmuir
d3e98f52ef [SourceKit] Add parameter.name.local and parameter.name.external tags
... for the fully annotated declarations. More substructure more better.
This has to go through a callback mechanism similar to printDeclLoc and
printDeclPre since it should be scheduled after both of those are
printed.

rdar://problem/24292226
2016-02-24 15:26:46 -08:00
Ben Langmuir
3e9bfa137d [SourceKit] Add decl.var.parameters entries to the fully annotated decl
This is the first part of adding parameter substructure so that clients
can reason about more of the function declaration.

rdar://problem/24292226
2016-02-24 11:39:47 -08:00
Max Moiseev
0b759a409c Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-23 14:26:14 -08:00
Dmitri Gribenko
7235595264 Merge pull request #1108 from tinysun212/porting-to-cygwin
Porting to cygwin
2016-02-22 18:53:30 -08:00
Max Moiseev
fcad164e18 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-22 12:59:57 -08:00
Xi Ge
bf1436a367 ASTPrinter: Move the logic for collecting all module groups from SourceKit to an IDE API, NFC. 2016-02-22 11:50:34 -08:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00