Commit Graph

17 Commits

Author SHA1 Message Date
Anthony Latsis
4ee63da498 Gardening: Migrate test suite to GH issues: decl/protocol 2022-08-30 04:08:00 +03:00
Slava Pestov
dac8d666ee Stop passing -requirement-machine-{abstract,inferred,protocol}-signatures flags in tests
These flags are now no-ops.
2022-05-10 12:56:17 -04:00
Slava Pestov
e4973158d8 AST: -debug-generic-signatures protocol-qualifies DependentMemberTypes 2022-01-19 22:36:15 -05:00
Slava Pestov
2441e688e4 Pass -requirement-machine-protocol-signatures=on in a few tests where the GSB got it wrong
These fail with -requirement-machine-protocol-signatures=verify because
the GSB produces incorrect output. Enable the requirement machine
unconditionally for these tests, bypassing verification.

A new file test/Generics/same_type_requirements_in_protocol.swift
contains reduced versions of all of the failures, with FileCheck
used to confirm the exact requirement signature output.
2021-12-14 02:17:51 -05:00
Robert Widmann
dce1e2ea32 [Gardening] Remove unnecessary options and files from tests 2019-09-10 18:15:16 -07:00
Doug Gregor
63504e4099 [GSB] Recognize self-derived protocol requirements within a protocol.
When computing the requirement signature of a protocol, eliminate requirement
sources that are self-derived by virtual of using a given requirement of
that protocol to prove that same constraint.
2017-09-18 16:40:03 -07:00
Doug Gregor
1e21d8df8a [GSB] Eliminate self-derived nested-type-name-match constraints..
Nested-type-name-match constraints are odd because they are
effectively artifacts of the GenericSignatureBuilder's algorithm,
i.e., they occur when we have two PotentialArchetypes representing the
same type, and each of those PA's has a nested type based on the same
associated type. Because of this, nested-type-name-match constraints
have no useful requirement sources, so the normal means of detecting
self-derived constraints doesn't suffice, and we end up with
self-derived nested-type-name-match constraints eliminating the
constraints they depend on, causing spurious "redundant same-type
constraint" diagnostics and minimized generic signatures that drop
important requirements.

Handle nested-type-name-match constraints by first keeping them out of
the connected-components algorithm used to compute same-type
constraints within an equivalence class. Then, detect self-derived
nested-type-name-match constraints by determining whether any of the
ancestor potential archetypes are in the same equivalence class... and
redundant with the edge that makes the ancestor potential archetypes
equivalent. Remove such self-derived edges, and treat all other
nested-type-name-match edges as derived, providing a minimized
signature.

Fixes SR-5841, SR-5601, and SR-5610
2017-09-12 06:11:53 -07:00
Doug Gregor
ed87c343bd [GSB] Detect self-derived conformances within same-type requirement sources.
Detect requirement sources that are internally self-derived for
(e.g.) handling of requirement sources for same-type constraints and
superclass constraints. This eliminates some incorrect warnings about
redundant same-type constraints involving recursive protocols, which
(more importantly) were a symptom of incorrect generic signature
minimization.

Fixes SR-5473.
2017-07-27 15:02:33 -07:00
Doug Gregor
d589cb720f [GSB] Retain minimal conformance sources within self-derived sources.
More correctly fix SR-5485: we were retaining self-derived conformance
sources when we shouldn't, which led to spurious "redundant
conformance" diagnostics and (much worse) incorrect minimized generic
signatures. Now, when we detect a self-derived conformance source,
return the minimal source that will derive the same conformance... and
retain that one if it's new.
2017-07-27 11:06:48 -07:00
Doug Gregor
469e9e08a5 SE-0157: Enable recursive protocol constraints by default.
We don't know if they work in general, but specific cases of recursive
protocol constraints are working, and enabling them doesn't break
anything.
2017-07-26 20:57:24 -07:00
Doug Gregor
0a7b977597 [GSB] "Self: P" in requirement signatures aren't self-derived.
When determining whether a conformance requirement source is
self-derived, ignore the top-level "Self: P" requirement in a
requirement signature.

Fixes SR-5485 / rdar://problem/33360699.
2017-07-25 15:02:51 -07:00
Doug Gregor
6177f83f01 [GSB] SE-0157: Reprocess delayed requirements when we need a complete PA.
Whenever we need a complete, well-formed potential archetype,
reprocess any delayed requirements, so that we pick up additional
requirements on that potential archetype.

This relies on us tracking a generation count for the GSB instance as
a whole, which gets bumped each time we add some new requirement or
create a new potential archetype, and only actually reprocessing
delayed requirements when the generation count exceeds the point at
which we last processed delayed requirements.

This gets the most basic recursive protocol constraint working
end-to-end and doesn't seem to break things.
2017-07-25 12:56:50 -07:00
Mark Lacey
5acc14022a Revert "[GSB] SE-0157: Reprocess delayed requirements when we need a complete PA."
This reverts commit ded45a6e1c.

This seems to slow down type checking of Swift.o by more than 3x.
2017-07-13 16:07:01 -07:00
Mark Lacey
ed23eb3761 Revert "SE-0157: Enable recursive protocol constraints by default."
This reverts commit afbdbae9d9.

Commit ded45a6e1c more than triples the
type checking time when building Swift.o, so I am going to revert that ,
and it looks like this needs to be reverted as well if that commit is
reverted.
2017-07-13 16:05:03 -07:00
Doug Gregor
afbdbae9d9 SE-0157: Enable recursive protocol constraints by default.
We don't know if they work in general, but specific cases of recursive
protocol constraints are working, and enabling them doesn't break
anything.
2017-07-13 13:01:11 -07:00
Doug Gregor
ded45a6e1c [GSB] SE-0157: Reprocess delayed requirements when we need a complete PA.
Whenever we need a complete, well-formed potential archetype,
reprocess any delayed requirements, so that we pick up additional
requirements on that potential archetype.

This relies on us tracking a generation count for the GSB instance as
a whole, which gets bumped each time we add some new requirement or
create a new potential archetype, and only actually reprocessing
delayed requirements when the generation count exceeds the point at
which we last processed delayed requirements.

This gets the most basic recursive protocol constraint working
end-to-end and doesn't seem to break things.
2017-07-12 17:23:23 -07:00
Doug Gregor
70b75491a0 SE-0157: Add a frontend flag -enable-recursive-constraints.
Introduce `-enable-recursive-constraints` to disable the error about
direct recursion within a protocol definition. The implementation of
recursive protocol constraints is incomplete, but might be useful for
experimentation.
2017-07-12 14:55:55 -07:00