My 'declIsPrivate' predicate was too conservative: it saw a PatternBindingDecl,
didn't know what it was, and decided that meant it might not be private. Now it's
actually checking the decl kind and doing something reasonable for non-ValueDecls.
Swift SVN r30282
I think this is all working fine: we already say that a type adopting a
protocol depends on that protocol's members, and that an extension of a
protocol can supply members. It's a pretty conservative mechanism since
it doesn't take the constraints into account, but that's okay for now.
rdar://problem/20476867
Swift SVN r28475
Instead, just check the generic parameters, then do a lookup as usual in the
enclosing context.
Fixes crash suite #58 and quite a few others (~200). This looks way more
impressive than it is; in most of these test cases it's the exact same
pattern causing the crash, and that pattern was just the last outstanding
crash trigger in a sea of garbage. (The few deleted tests were identical
to #58.)
Swift SVN r24748
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
If a conformance is found for a type in another module, that conformance
will never change in response to what happens in this module, so we don't
need to treat it as a dependency at all.
Swift SVN r23702
Specifically, it's not when
- the conformance is being used within a function body (test included)
- the conformance is being used for or within a private type (test included)
- the conformance is being used to generate a diagnostic string
We're still a bit imprecise in some places (checking ObjC bridging), but
in general this means less of an issue for checking literals.
Swift SVN r23700
...and thus does not affect downstream files...
...and adopt it in several places:
- when looking up the default type for a literal (test included)
- when looking up the first component in an IdentTypeRepr (test included)
- when deciding which ~= to use in a switch (test forthcoming)
- when a protocol has an operator function requirement (test forthcoming)
- when validating @NSApplicationMain and @UIApplicationMain
- when an enum element shows up unqualified in a switch
- several places where it doesn't matter because we're looking something up
in the standard library.
Part of rdar://problem/15353101
Swift SVN r23670
Extensions of private types can't affect anything outside the current file,
so we shouldn't treat them as having cascading dependencies on protocols
they add conformances for. However, the previous commits didn't actually
make sure we'd computed an extension's default access by the time we start
checking its conformances.
Swift SVN r23634
This adds a check to isPrivateContextForLookup, and also changes Sema to
use a function itself as the lookup context for non-generic functions'
result types (like generic functions already do). It also moves
isPrivateContextForLookup onto DeclContext itself, to be used in the next
commits.
Swift SVN r23633
This adds a new parameter to TypeChecker::lookupMember to specify when
something is known-private, which can then be passed along to
DeclContext::lookupQualified. This makes many of the existing member
lookup dependencies in the reference-dependencies.swift test correctly
count as private.
Swift SVN r23631
This adds a new flag TR_KnownPrivateDependency, which is a bit stronger than
TR_InExpression. The latter only results in private dependencies when the
decl context is a function, or when the context is otherwise private.
Swift SVN r23524
Again, expression contexts are those that can't show up in a function
signature, so type resolution in a function decl context can assume
that all resulting type dependencies are private.
Swift SVN r23523
This commit treats all TypeExprs and casts as private if the decl context
is a function. In other cases we fall back to the general rules about the
current context (from r23447).
Swift SVN r23522
Previously we were using the enum itself as the decl context to look up
enum members in switch case patterns. This meant that we weren't respecting
access control rules (not an issue, since enum cases currently don't have
access control), nor recording the dependency on the enum (oops).
Swift SVN r23521
This is the start of distinguishing qualified lookups within function bodies
from qualified lookups in a function signature. Both of these use the
function itself as the decl context, so we need to distinguish them manually.
This particular commit doesn't change much because expressions don't often
use TypeMember constraints. But it does help with for-loops!
Swift SVN r23484
Previously we would fail to find something in a private context, jump up
to a public context, and decide that the dependency was now non-private.
Swift SVN r23482
This does reveal an overly conservative case: lookup in the inheritance
clause of extensions is always considered a non-private lookup, even if
it's extending a private type, because we haven't yet resolved what it's
extending. Won't lead to incorrect behavior, just more compilation than
is strictly necessary.
Swift SVN r23481
Previously we could fail to capture dependencies on other modules. Why is
this a problem? Because a file in the main module could introduce a new
operator decl with the same name (at least in theory).
Swift SVN r23448
This is sort of two commits squashed into one: first, update
ReferencedNameTracker to record whether a name or type is non-private,
along with changing all clients to assume non-private; and second,
actually try to (conservatively) decide if a particular unqualified lookup can
be considered private.
What does "private" mean? That means that a dependency does not affect
"downstream" files. For example, if file A depends on B, and B depends on C,
then a change in C normally means A will get rebuilt. But if B's dependencies
on C are all private dependencies (e.g. lookups from within function bodies),
then A does not need to be rebuilt.
In practice there are several rules about when we can make this assumption,
and a few places where our current DeclContext model is not good enough to
distinguish private uses from non-private uses. In these cases we have to
be conservative and assume that the use is non-private (and thus that
downstream files will need to be rebuilt).
Part of rdar://problem/15353101
Swift SVN r23447
This isn't so interesting because we already depend on the top-level name
of a protocol, but it becomes more interesting if/when we start allowing
protocol extensions.
Part of rdar://problem/15353101
Swift SVN r23392
We need to do this mainly to figure out when extensions can affect this file.
This is part of the intra-module dependency tracking work to implement
incremental rebuilds.
Part of rdar://problem/15353101
Swift SVN r22927
Every name a file declares is something that another file in the same module
might depend on. The driver will need this information too to correctly
decide what files need to be rebuilt. This is part of the intra-module
dependency tracking work to implement incremental rebuilds.
This doesn't handle extensions yet, which are a bit trickier. Need to
figure out how to handle the interaction between extensions and typealiases.
Part of rdar://problem/15353101
Swift SVN r22926
This tracks top-level qualified and unqualified lookups in the primary
source file, meaning we see all top-level names used in the file. This
is part of the intra-module dependency tracking work that can enable
incremental rebuilds.
This doesn't quite cover all of a file's dependencies. In particular, it
misses cases involving extensions defined in terms of typealiases, and
it doesn't yet track operator lookups. The whole scheme is also very
dependent on being used to track file-level dependencies; if C is a subclass
of B and B is a subclass of A, C doesn't appear to depend on A. It only
works because changing A will mark B as dirty.
Part of rdar://problem/15353101
Swift SVN r22925