Commit Graph

4 Commits

Author SHA1 Message Date
Doug Gregor
fea55d98f2 Eliminate dependent types from within archetypes.
When dealing with multiple levels of generic parameters, the mapping
from potential archetypes down to actual archetypes did not have
access to the archetypes for outer generic parameters. When same-type
requirements equated a type from the inner generic parameter list with
one from the outer generic parameter list, the reference to the outer
generic parameter list's type would remain dependent. For example,
given:

  struct S<A: P> {
    init<Q: P where Q.T == A>(_ q: Q) {}
  }

we would end up with the dependent type for A (τ_0_0) in the same-type
constraint in the initializer requirement.

Now, notify the ArchetypeBuilder of outer generic signatures (and,
therefore, outer generic parameters), so that it has knowledge of the
mapping from those generic parameters to the corresponding
archetypes. Use that mapping when translating potential archetypes to
real archetypes. Additionally, when a potential archetype is mapped to
a concrete type (via a same-type constraint to a concrete type),
substitute archetypes for any dependent types within the concrete
type.

Remove a bunch of hacks in the compiler that identified dependent
types in "strange" places and tried to map them back to
archetypes. Those hacks handled some narrow cases we saw in the
standard library and some external code, but papered over the
underlying issue and left major gaps.

Sadly, introduce one hack into the type checker to help with the
matching of generic witnesses to generic requirements that follow the
pattern described above. See ConstraintSystem::SelfTypeVar; the proper
implementation for this matching involves substituting the adoptee
type in for Self within the requirement, and synthesizing new
archetypes from the result.

Fixes rdar://18435371, rdar://18803556, rdar://19082500,
rdar://19245317, rdar://19371678 and a half dozen compiler crashers
from the crash suite. There are a few other radars that I suspect this
fixes, but which require more steps to reproduce.

Swift SVN r24460
2015-01-16 00:27:18 +00:00
Dmitri Hrybenko
5d41b6ac9f Validation testsuite: annotate compiler crashers for AddressSanitizer
Tests that crash the compiler are expected to fail under
AddressSanitizer.

Swift SVN r24071
2014-12-22 18:22:07 +00:00
Chris Willmore
513b05c283 compiler_crashers: Use %target-swift-frontend instead of %swift -sdk %sdk
This fixes compiler_crashers tests that use the ObjC interface on
iOS hardware SDKs.

Swift SVN r23458
2014-11-20 00:32:59 +00:00
Chris Willmore
4e1fa4a63f Import the swift-compiler-crashes test suite.
Add all compiler crash tests to the validation-test/compiler_crashers
subdirectory. Add a RUN: line to each test case according to the current
behavior of the Swift compiler.

Swift SVN r23418
2014-11-19 01:27:58 +00:00