Commit Graph

557 Commits

Author SHA1 Message Date
Manman Ren
4970157f0e [SILParser] parsing extensions.
Fix a bug introduced in r20818, where we should print get for computed property.
Make sure we can round-trip extension of a generic class and extension of an
inner class.

rdar://17927072


Swift SVN r21151
2014-08-12 17:33:55 +00:00
Chris Lattner
b0a6d60172 fix the ast printer to not print 'convenience' twice in a case that fouled up the sil parser.
Swift SVN r21115
2014-08-08 21:28:48 +00:00
Doug Gregor
60b92937e8 Use the dynamic casting infrastructure for casts that bridge from Objective-C.
A checked cast such as "x as String" or "x as? [String]", where x is of
class or Objective-C existential type, is now handled as a normal
checked cast rather than a Sema-generated call to the corresponding
witness. This eliminates a pile of hairy code from constraint
application and takes a step toward <rdar://problem/17408934>.

The part of the switch_objc.swift test I removed wasn't testing
anything useful; that's what <rdar://problem/17408934> is about.



Swift SVN r20970
2014-08-03 16:39:28 +00:00
Doug Gregor
f52c6789db Track the minimum deployment target and use it for 'unavailable' computations.
Swift SVN r20955
2014-08-02 18:05:45 +00:00
Manman Ren
2573effad6 [SILParser] fix issues in parsing associated type decl.
Also avoid printing "@sil_stored let {get}", we currently can't generate
var_decl for it. Add diagnostics when looking up members.

Fix rdar://17712570


Swift SVN r20818
2014-07-31 06:26:09 +00:00
Doug Gregor
79d5c69d5a Remove CheckedCastKind::ArrayDowncastBridged. Nobody F'ing Cares about it now.
Swift SVN r20730
2014-07-30 04:26:16 +00:00
Jordan Rose
ab33113ad7 Add a dumpVerbose method to Type and TypeBase.
For debugging only.

Swift SVN r20667
2014-07-29 03:06:28 +00:00
Argyrios Kyrtzidis
48c3e4144a [ASTPrinter] Print 'mutating/nonmutating' for accessors.
Swift SVN r20534
2014-07-25 07:26:26 +00:00
Argyrios Kyrtzidis
992f5412ca [ASTPrinter] Print the underlying type of a typealias independently of PrintOptions.TypeDefinitions.
This is short and important enough to show in QuickHelp.
Test case in the SourceKit side.

Swift SVN r20460
2014-07-24 03:10:58 +00:00
Jordan Rose
00b6a5cb08 Import Objective-C properties marked weak/copy as weak/@NSCopying.
...and 'assign' and 'unsafe_unretained' as 'unowned(unsafe)', if the
property is a class type.

This isn't important for the compiler, but it is documentation for users
when they look at the generated interface for an Objective-C module.

Note that this actually produces a decl users can't yet write:

  unowned(unsafe) var foo: UIView!

That's <rdar://problem/17277899> unowned pointers can't be optional.

<rdar://problem/17245555>

Swift SVN r20433
2014-07-23 22:29:01 +00:00
Dmitri Hrybenko
1007ef3f95 Module interface printing: add an option to filter declarations based on
access control

Swift SVN r20399
2014-07-23 15:03:58 +00:00
Joe Groff
7feeecfd21 Sema: Bring back 'assignment' as an infix operator modifier.
We need it to decide whether to admit infix operators into an optional chain, such as 'x? = 0' or 'x?.y += 2'.

Swift SVN r20295
2014-07-22 05:16:01 +00:00
Chris Lattner
bc481f0fe1 implement <rdar://problem/16859927> remove the underscore in "auto_closure"
autoclosure is one work, not two.



Swift SVN r20253
2014-07-21 15:23:50 +00:00
Argyrios Kyrtzidis
21ead19f7e [ASTPrinter] Check the isMutating bit for printing 'mutating' for a function; revert the change that serialized the attribute.
Swift SVN r20236
2014-07-21 01:24:13 +00:00
Manman Ren
b697fe1364 [SILParser] fix parsing issues for stored_with_trivial_accessors.
Before this commit, we were not able to differentiate between stored
property and stored_with_trivial_accessors property. This causes issues
when parsing a SILDeclRef to a trivial getter.

We add @sil_stored for stored properties and we will have 3 cases
A) for stored property: @sil_storage var x : Int
B) for stored_with_trivial_accessors property:
   @sil_storage var x : Int { get set }
C) for computed property: var x : Int { get set }

Fix rdar://17715778 rdar://17381432 rdar://17347296.


Swift SVN r20189
2014-07-18 23:18:14 +00:00
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