Commit Graph

4 Commits

Author SHA1 Message Date
Doug Gregor
1b2caa7656 Remove local path names from test case :) 2016-02-25 20:54:40 -08:00
Doug Gregor
cf64a3539d [Archetype builder] Superclass requirements can make conformance requirements redundant.
If a particular type parameter is bound by a superclass requirement C
and also stated to conform to some protocol P to which C conforms, the
conformance to P is redundant. Treat it as such in the archetype
builder.
2016-02-25 20:41:39 -08:00
Doug Gregor
02dd1e407b [Archetype builder] Use protocol conformances of superclass to resolve nested types.
When a type parameter has a superclass constraint, the conformances of
the superclass can resolve some nested types of the type parameter via
the type witnesses for the corresponding associated types.

Fixes rdar://problem/24730536.
2016-02-24 13:18:27 -08:00
Slava Pestov
3aacf5d805 ArchetypeBuilder: Allow generic signature superclass constraints to contain type parameters
There was a diagnostic to catch these, but it wasn't triggered
reliably, and it sounds like users were already relying on this
feature working in the few cases where it did.

So instead, just map an archetype's superclass into context
when building the archetype.

Recursion is still not allowed and is diagnosed, for example
<T, U where T : C<U>, U : C<T>>.

Note that compiler_crashers_fixed/00022-no-stacktrace.swift no
longer produces a diagnostic in Sema, despite the fact that the
code is invalid. It does diagnose in IRGen when we map the
type into context. Diagnosing in Sema requires fixing the
declaration checker to correctly handle recursion through a
generic signature. Right now, if recursion is detected, we bail
out, but do not always diagnose. Alternatively, we could
prohibit unbound generic types from appearing in generic
signatures.

This is a more principled fix for rdar://problem/24590570.
2016-02-11 23:23:26 -08:00