Commit Graph

1015 Commits

Author SHA1 Message Date
Joe Groff
4e87971d81 Disallow bare type references.
Diagnose a metatype reference that doesn't appear as part of a call or member reference, offering fixits to either default-construct the type or get at the metatype explicitly using '.self'. Also diagnose an attempt to refer to 'T.type' by fixiting it to '.self'.

Swift SVN r14433
2014-02-27 00:22:02 +00:00
Joe Groff
c0d8ae7c13 Parse 'x.self' as an identity expression.
Factor an IdentityExpr base class out of ParenExpr, and migrate most of the logic to see through ParenExprs to see through IdentityExprs instead. Add DotSelfExpr as a new subclass of IdentityExpr, produced by parsing 'x.self'.

Swift SVN r14381
2014-02-26 06:23:55 +00:00
Chris Lattner
d690a63a87 progress towards non-member observing properties:
- Add a "isDirectPropertyAccess" bit to DeclRefExpr, serving the 
   same purpose as MemberRefExprs for non-member properties.
 - Teach sema to synthesize correct non-member get/set implementations
   for observing properties.
 - Teach silgen to handle the isDirectPropertyAccess bit.



Swift SVN r13600
2014-02-06 22:34:37 +00:00
Chris Lattner
929ad99f08 Clean up and generalize the code pertaining to how a FuncDecl accessor
knows about the AbstractStorageDecl it works on.  NFC.



Swift SVN r12994
2014-01-27 17:57:38 +00:00
Chris Lattner
0dfb1ec790 introduce a new "IsDirectIVarAccess" bit to MemberRefExpr. Properties
that have both storage AND accessors are accessed by-default through
their accessors.  This bit indicates that a specific MRE should access
the storage instead.

Use this new bit in the synthesized getter/setter for "StorageObjC"
properties (it will also be used for other things in the future).
This also teaches SILGen about it.

One interesting aspect of this representation is that it makes it trivial
to add some expression syntax for directly accessing a store+computed 
property (e.g. ObjC properties, also someday didSet/willSet properties) 
someday if we care.  This would be analogous to the "self->ivar" syntax
in objc (vs self.ivar).  No, we will not use "->" for this. :-)

NFC since this is the use is still hidden under the -enable-new-objc-properties
staging option.



Swift SVN r12965
2014-01-26 06:08:53 +00:00
Jordan Rose
ae2868b482 Clean up comments in MiscDiagnostics.cpp.
No functionality change.

Swift SVN r12457
2014-01-17 02:58:25 +00:00
Jordan Rose
a6b616ad9e Accessing a property on another instance within the property's getter is okay.
There was a test for this but it wasn't really accurate. We now look for
MemberRefExprs where the base is literally just an implicit DeclRefExpr,
rather than something loaded from an implicit DeclRefExpr. This could break
with future AST refinement, but that will at least fail the test now.

Swift SVN r12456
2014-01-17 02:58:24 +00:00
Jordan Rose
77d5385c5d Warn on recursive mutation within a property setter.
The other half of <rdar://problem/14083624>

Swift SVN r12455
2014-01-17 02:58:23 +00:00
Jordan Rose
890df62a16 Warn on recursive computed variable access within its own getter.
Part of <rdar://problem/14083624>

Swift SVN r12454
2014-01-17 02:58:22 +00:00
Dmitri Hrybenko
c2c15e401b Disallow use of module values
rdar://15000289


Swift SVN r10546
2013-11-18 20:45:50 +00:00
Dmitri Hrybenko
9329ef41a5 Assigning variable to itself: fix a bug where we did not handle member
experssions with a complex base correctly

rdar://15405383


Swift SVN r10002
2013-11-06 20:05:14 +00:00
Anna Zaks
f8a79a56fb Address the reviews for r9982
Swift SVN r9999
2013-11-06 19:46:20 +00:00
Anna Zaks
c8ed1954f2 Issue a warning when returned expression is on the next line after the return keyword.
We still want to allow line wrapping, so only issue the warning when the indentation of the expression and the return keyword is the same.

radar://11945406

Swift SVN r9984
2013-11-06 02:00:13 +00:00
Dmitri Hrybenko
25c0c1b3b0 Self-assignment diagnostic: pass 'const Expr' where possible
Swift SVN r9981
2013-11-06 00:44:54 +00:00
Dmitri Hrybenko
61c067fe5f Implement a check in Sema to find self-assignment
rdar://14151649 suggests that it should be a warning, but I don’t see a reason
why it should not be an error.  We have no legacy code that relies on this.


Swift SVN r9976
2013-11-05 23:43:54 +00:00