Commit 1aa4c38
committed
RequirementMachine: Workaround invariant violation when requirement signature completion fails
- If P is declared to inherit from Q and Q has an associated type named U, then
isValidTypeInContext() returns true for a type 'T.U' where 'T' is a generic
parameter conforming to P, and 'U' is the unresolved DependentMemberType, and
the type 'T.U' will simplify to the term 'T.[P:U]'.
- However, if completion failed while building the rewrite system for P's
requirement signature, then the requirement signature for P won't have a
rule [P].[Q] => [P]. As a result, getTypeForTerm() will fail when given
'T.[P:U]', because the property map entry for 'T' will not contain a
conformance to Q.
Work around this by manually adding protocol inheritance rules when building
a signature from a protocol whose requirement signature failed to compute.
This was triggered by the test case I added in the previous commit to
test/Generics/non_confluent.swift.1 parent e46da05 commit 1aa4c38
1 file changed
+15
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
104 | 119 | | |
105 | 120 | | |
106 | 121 | | |
| |||
0 commit comments