generic signature canonicalization eliminates the redundant T: Q requirement from the top-level signature, but T can still appear in type contexts that require Q, and functions like Substitution::subst fail to anticipate these non-canonical generic signatures and fail to find the T: Q conformance via the same-type constraint.
The text was updated successfully, but these errors were encountered:
@slavapestov loosened these restrictions as part of supporting extensions of concrete types, e.g.,:
extension Array where Element == String { ... }
It's plausible that we could reject some instances of this, but I'm not sure that we should. Rather, we need to finish fixing `Substitution::subst` et al.
OK. We could still perhaps warn or error on a type or function declaration that introduces type variables that are always redundant, though with constrained extensions I guess we'd still end up having to digest this kind of generic signature downstream.
Additional Detail from JIRA
md5: ef3a5ad18502b4610ec6586b03f8062a
Issue Description:
The
T
parameter in the classC
below is eliminated by the subsequentT == U.T
same-type constraint:Accepting this signature leads to downstream problems with things like the specializer. For example, with a signature like this:
generic signature canonicalization eliminates the redundant
T: Q
requirement from the top-level signature, butT
can still appear in type contexts that requireQ
, and functions likeSubstitution::subst
fail to anticipate these non-canonical generic signatures and fail to find theT: Q
conformance via the same-type constraint.The text was updated successfully, but these errors were encountered: