Commit Graph

7 Commits

Author SHA1 Message Date
Slava Pestov
1904960829 Sema: Fix a couple of problems with capture analysis and TopLevelCodeDecls
A TopLevelCodeDecl is a local context and any declarations inside
of one must be treated as captures. Furthermore, all the
TopLevelCodeDecl children of a source file are peers, and can
see each other's bindings, so don't perform an exact match on the
DeclContext.

Part of <rdar://problem/23051362> / <https://bugs.swift.org/browse/SR-3528>.
2019-12-19 23:46:01 -05:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Chris Lattner
0e20f24b95 fix <rdar://problem/18734297> Reject access to local variables from local types
init()'s implicitly evaluate the initial values for properties, and we aren't modeling
that correctly in the AST.  This prevented the closure checker from noticing these 
accesses, leading to SILGen crashing later.  In the absence of proper AST modeling of
this, add special case handling for them.



Swift SVN r29508
2015-06-19 06:15:19 +00:00
Slava Pestov
8eabf84450 Sema: diagnose capturing type declarations for now
Properly implementing a class whose methods capture variables
defined in the outer scope requires adding the captures as
hidden vars in the class and initializers, and seems
non-trivial.

Just diagnose this case for now instead of crashing.

Fixes <rdar://problem/20853958>.

Swift SVN r28481
2015-05-12 18:19:37 +00:00
Chris Lattner
4366da9250 more testcase updates for upcoming diagnostics change.
Swift SVN r28409
2015-05-11 06:05:00 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Doug Gregor
1082ea51a0 Actual use location information when looking for local variables.
This addresses the bulk of <rdar://problem/15344950>, which involes us
not being able to find local variable declarations in expressions when
the parser didn't pre-bind them for us.

The fix to name lookup itself insures that a case such as 
  case (var a, a)

doesn't allow the second 'a' to find the first.


Swift SVN r9858
2013-10-31 22:56:02 +00:00