Commit Graph

2092 Commits

Author SHA1 Message Date
Manman Ren
1bd9d81971 [SILParser] fix a few issues to enable parsing of sil from swift array
Add PrintForSIL in PrintOptions
1> for NameAliasType, we print getSinglyDesugaredType()
I attempted another option: set FullyQualifiedTypes of PrintOptions, but that
will print xxx.Type.xxx and Parser can’t handle it.
2> for Self, we print @sil_self

We also work around parsing:
sil_witness_table _CocoaArrayType: _CocoaArrayType

sil_vtable uses internal classes in stdlib, so we use lookupTopDecl instead
of lookupValue when parsing sil_vtable, to find internal classes.

Fix rdar://17261925 rdar://17295316 rdar://17046276 rdar://17579890


Swift SVN r20070
2014-07-17 04:43:24 +00:00
Ben Langmuir
073d3a441c Print precedence and associativity of infix operator decls
To answer "did the user specify this, or is it implicit", stick a couple
of is-implicit bits in InfixOperatorDecl, and thread them through
serializaton/deserialization.

Swift SVN r20067
2014-07-17 03:20:01 +00:00
Ben Langmuir
09f465ee64 Don't print sugar or generic parameters in extensions
Before:
extension [T] : P { }
extension Foo<T> : P { }

After:
extension Array : P { }
extension Foo : P { }

<rdar://problem/16613904>

Swift SVN r20057
2014-07-16 22:55:48 +00:00
Enrico Granata
fd26fa859f Jordan suggested I could use a named constant here instead of hardcoding the string, so that LLDB could share the constant and we'd never get out of sync again. It's a clearly A Good Idea, and even though this entire isLLDBExpressionModule() is a temporary hack, this improvement is worth it
Swift SVN r20046
2014-07-16 22:12:43 +00:00
Enrico Granata
e623dac540 The magic module name is now __lldb_expr_, so adjust the detection logic.
Swift SVN r20039
2014-07-16 21:18:59 +00:00
Chris Lattner
fe30b66a93 move "override" onto the new fangle decl modifier code, instead of being a virtual
attribute.  As part of this, introduce a new "NotSerialized" flag in Attr.def.
This eliminates a bunch of special case code in the parser and elsewhere for handling
this modifier.



Swift SVN r19997
2014-07-16 01:23:58 +00:00
Argyrios Kyrtzidis
7b62fa0c44 [ASTPrinter] Introduce a callback invoked after printing the name of the declaration (the signature for functions).
Swift SVN r19973
2014-07-15 05:56:54 +00:00
Joe Groff
45eec9a2e9 Remove 'interface' from the method names of SILFunctionType.
SILFunctionTypes are always interface types now. NFC.

Swift SVN r19952
2014-07-14 22:03:46 +00:00
Chris Lattner
57cd2506ff Change "operator infix" to "infix operator" for consistency with the rest of the declaration
modifiers and with the func implementations of the operators.  This resolves the rest of:
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword




Swift SVN r19931
2014-07-14 16:39:10 +00:00
Doug Gregor
a5c079af59 Replace the class_protocol attribute with a "class" requirement.
This only tackles the protocol case (<rdar://problem/17510790>); it
does not yet generalize to an arbitrary "class" requirement on either
existentials or generics.

Swift SVN r19896
2014-07-13 06:57:48 +00:00
Jordan Rose
3f59d6b9ee Drop the '@' from access control modifiers.
Test and stdlib changes to follow.

Swift SVN r19671
2014-07-08 02:16:59 +00:00
Jordan Rose
132a29eb67 Remove unnecessary wrapper type GenericParam.
This always wrapped a single GenericTypeParamDecl *, and provided no benefit
over just using the decl directly.

No (intended) functionality change.

Swift SVN r19628
2014-07-07 20:51:50 +00:00
Jordan Rose
61d12a314f Add a test for local enum == synthesis.
Along the way, fix AST printing for PatternBindingDecls that contain no
variables.

Swift SVN r19520
2014-07-03 17:45:37 +00:00
Jordan Rose
147d7eb254 Remove unused variable.
Swift SVN r19431
2014-07-01 22:30:50 +00:00
Doug Gregor
8a0716c98a Synthesize dictionary type sugar during AST printing (when requested).
Swift SVN r19255
2014-06-26 21:21:09 +00:00
Doug Gregor
07a7059934 Preserve dictionary type sugar in the type system.
Another piece of <rdar://problem/17460972>.


Swift SVN r19253
2014-06-26 21:12:19 +00:00
Doug Gregor
55df89aabe Print array types as [T] instead of T[].
Swift SVN r19195
2014-06-25 23:59:51 +00:00
Jordan Rose
20bc9ec2b9 Add accessibility printing, and test the accessibility inference so far.
Swift SVN r19144
2014-06-24 21:32:15 +00:00
Argyrios Kyrtzidis
1c86427b90 Fix crash when trying to print an inherited type that was not resolved.
Test case on the SourceKit side.
rdar://16706082

Swift SVN r19068
2014-06-21 16:59:29 +00:00
John McCall
385879beea Remove the CheckedCastKind from SIL dynamic casts.
It is straightforward and less redundant to recover this
information from the operand types.

Swift SVN r19056
2014-06-20 22:43:53 +00:00
Doug Gregor
39e1b0886d Start using ConditionalCheckedCastExpr and ForcedCheckedCastExpr for collection downcasts.
NFC; just a cleanup.


Swift SVN r18979
2014-06-18 13:00:57 +00:00
Doug Gregor
5bb6969af3 Type checker support for dictionary downcasting.
This is the semantic-analysis portion of <rdar://problem/16847470>.


Swift SVN r18900
2014-06-14 18:27:38 +00:00
Nadav Rotem
bb0438f27b [Early Binding of Virtual Calls] Add a new kind of unconditional_checked_cast: Identical cast. This cast checks that the class that we inspect is exactly the type we expect, and not a subclass of that type.
Swift SVN r18859
2014-06-13 06:15:14 +00:00
Joe Pamer
ef75f7283a Take first steps towards eliminating un-substituted type variables from our diagnostic output.
Swift SVN r18750
2014-06-09 17:49:43 +00:00
Argyrios Kyrtzidis
43a8d4e285 [AST] Fix crash when printing a function with a missing parameter type.
rdar://17070704

Swift SVN r18665
2014-05-30 00:28:43 +00:00
Argyrios Kyrtzidis
6054e2e685 [AST] Hide as private symbols that use types from the Builtin module.
rdar://17053694

Swift SVN r18657
2014-05-28 21:17:44 +00:00
Argyrios Kyrtzidis
829473a5dd [AST] Print a 'public' typealias with a 'private' underlying type by printing the declaration but not its underlying type.
Swift SVN r18656
2014-05-28 21:17:42 +00:00
Argyrios Kyrtzidis
95bd9e1d28 [AST/IDE] Centralize the logic to determine if a symbols is a 'private' stdlib one and hide them more extensively.
-Hide vars that have a private type.
-Hide functions that have a parameter with private type or a parameter name with leading underscore.
-Minor change in StringUTF16.swift to avoid printing "func generate() -> IndexingGenerator<_StringCore>".

rdar://17027294

Swift SVN r18623
2014-05-25 03:49:02 +00:00
Dmitri Hrybenko
d1a2a2ab39 AST printer: don't qualify names from system overlays
rdar://17003635


Swift SVN r18566
2014-05-22 19:21:11 +00:00
Enrico Granata
24469df78f This patch teaches the TypePrinter that lldb_expr_ is a reserved module name prefix, and it should not print it
This is a temporary solution to get us through WWDC - we will do better after the conference - Dmitri and I discussed the plan as part of getting this patch approved
Radar will be filed shortly!

In the interim, this fixes rdar://16934039



Swift SVN r18530
2014-05-21 23:19:31 +00:00
Argyrios Kyrtzidis
cfa64f4f6e [IDE] For AST printing, adjust recordDeclLoc() invocations at the point where Decl::getLoc() would point,
which is generally before the name.

Fixes rdar://16887111

Swift SVN r18448
2014-05-20 07:36:25 +00:00
Doug Gregor
5783d0b313 Revert r19185: Add T* syntactic sugar type for UnsafePointer<T>.
Swift SVN r18255
2014-05-17 16:43:46 +00:00
Doug Gregor
806daf3a87 Add T* syntactic sugar type for UnsafePointer<T>.
This is the basic plumbing for <rdar://problem/16912508>.


Swift SVN r18195
2014-05-16 15:30:26 +00:00
Doug Gregor
c4622014f8 Start importing NSArray* with the sugar AnyObject[]! rather than Array<AnyObject>!.
... and simplify type printing so we don't overparenthesize such types.



Swift SVN r18183
2014-05-16 06:17:38 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Joe Pamer
1e5b9116d4 More array casting work:
- Continue adding support for checked downcasts of array types (rdar://problem/16535104)
- Fix non-bridged array conversions post-r17868
- Fix rdar://problem/16773693
- Add tests for NSArray coercions to and from Array<T>

Swift SVN r17957
2014-05-12 20:49:42 +00:00
Dmitri Hrybenko
266cd9714a AST printing: print native documentation comments
This will be extremely useful for the standard library.

rdar://16829672


Swift SVN r17826
2014-05-10 16:30:12 +00:00
Argyrios Kyrtzidis
be7e6653fd [IDE] Don't print inherited types and conformances that start with underscore,
if PrintOptions.SkipLeadingUnderscoreDecls is enabled.

Swift SVN r17762
2014-05-09 06:10:22 +00:00
Argyrios Kyrtzidis
16d4b98b83 [ASTPrinter] Add more printing options, SkipAttributes/SkipIntroducerKeywords/ArgAndParamPrintingMode.
Swift SVN r17677
2014-05-08 04:17:40 +00:00
Ted Kremenek
0b2c23ffec Remove special printing of ImplicitlyUnwrappedOptional<T>.
Part of <rdar://problem/16836463>

Swift SVN r17610
2014-05-07 06:59:52 +00:00
Argyrios Kyrtzidis
42484084f2 [ASTPrinter] Add an option to always print the keyword argument and the parameter,
even if they are the same.

rdar://16799973

Swift SVN r17412
2014-05-05 00:52:06 +00:00
Chris Lattner
2427e36ff8 Introduce a new "convenience" context sensitive keyword, which can only be
used on init decls, with the same semantics as "-> Self".  Switch the ast
printer, and fixits to use it.

As driveby's, simplify verification of contextual keywords in declparsing,
and rename parseConstructor/Destructor to parseInit/Deinit.


Swift SVN r17356
2014-05-04 04:02:32 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Doug Gregor
d003b74c85 An argument with a default value has a keyword argument.
Arguments with default values are one of those places where you
really, really want keyword arguments: make that the default.


Swift SVN r17080
2014-04-30 06:51:43 +00:00
Doug Gregor
72e32c93af Make argument names default to keyword arguments in the cases where Objective-C has names.
Introduce a model where an argument name is a keyword argument if: 

  - It is an argument to an initializer, or
  - It is an argument to a method after the first argument, or
  - It is preceded by a back-tick (`), or
  - Both a keyword argument name and an internal parameter name are
    specified. 

Provide diagnostics Fix-Its to clean up cases where the user is
probably confused, i.e.,

  - "_ x: Int" -> "x: Int" where "x" would not have been a keyword
  argument anyway
  - "x x: Int" -> "`x: Int"

This covers the compiler side of <rdar://problem/16741975> and
<rdar://problem/16742001>.

Update the AST printer to print in this form, never printing just 
a type for a parameter name because we're also going to adopt
<rdar://problem/16737312> and it was easier to move the tests once
rather than twice.

Standard library and test updates coming separately.




Swift SVN r17056
2014-04-30 00:04:04 +00:00
Chris Lattner
a7012f23ef Remove swift::ArrayType. It is dead and vestigial code for supporting fixed size
arrays, which never got baked.  Remove it until we have time to do things right.


Swift SVN r16995
2014-04-28 21:18:27 +00:00
Ted Kremenek
6caf910d32 Implement new syntactic sugar for UncheckedOptional<T>.
This leaves in the existing syntax for @unchecked T?.  That will
be addressed in later patches.

There's still a mysterious case where some of the SIL output
includes UncheckedOptional<T> and some places T!.

Moreover, this doesn't handle SourceKit's behavior for printing
for overrides.  This just handles parsing the 'T!' syntax.

Swift SVN r16945
2014-04-27 21:59:29 +00:00
Dmitri Hrybenko
739c495282 AST printer: use identifier escaping
rdar://16233153


Swift SVN r16933
2014-04-27 17:25:24 +00:00
Dmitri Hrybenko
dc406b31c2 AST printer: don't print "let ... { get }" -- this is not valid syntax
rdar://16281510


Swift SVN r16927
2014-04-27 15:18:31 +00:00
Chris Lattner
0c390777ba Implement <rdar://problem/16204675> Need #elseif
This restructures IfConfigDecl/Stmt to be a list of clauses controlled
by a condition.  This makes it straight-forward to drop in #elseif support.

While I'm in here, this patch moves checking for extraneous stuff at the
end of the #if line from the lexer to the parser.  This means that you can
now put a comment on the same line as a #if/#else/#elseif/#endif.



Swift SVN r16912
2014-04-27 04:51:36 +00:00