Skip to content

Commit 3e1b2ca

Browse files
committed
lint tautological constraints
1 parent 4630bed commit 3e1b2ca

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Sources/UnidocLinker/Sema/Unidoc.ExtensionConditions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extension Unidoc
55
{
66
struct ExtensionConditions:Equatable, Hashable, Sendable
77
{
8-
let constraints:[GenericConstraint<Unidoc.Scalar?>]
8+
var constraints:[GenericConstraint<Unidoc.Scalar?>]
99
let culture:Int
1010

1111
init(constraints:[GenericConstraint<Unidoc.Scalar?>], culture:Int)

Sources/UnidocLinker/Sema/Unidoc.Linker.Table.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,20 @@ extension Unidoc.Linker.Table<Unidoc.Extension>
163163
}
164164
}
165165

166-
for (conditions, `extension`):
166+
for (var conditions, `extension`):
167167
(Unidoc.ExtensionConditions, SymbolGraph.Extension) in zip(
168168
conditions,
169169
extensions)
170170
{
171+
if case .protocol = extendedDecl.phylum
172+
{
173+
/// Lint tautological `Self:#Self` constraints. These exist in extensions to
174+
/// ``RawRepresentable`` in the standard library.
175+
conditions.constraints.removeAll
176+
{
177+
$0 == .where("Self", is: .conformer, to: .nominal(s))
178+
}
179+
}
171180
// It’s possible for two locally-disjoint extensions to coalesce
172181
// into a single global extension due to constraint dropping...
173182
{

0 commit comments

Comments
 (0)