-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
this is a hole that is originally caused by the Swift compiler bug swiftlang/swift#78343 , but is not sufficiently patched by Unidoc’s downstream heuristics.
specifically, given two extensions like these
struct S<T> {}
extension S<Int>
{
static var x:Self { get }
}
extension S<String>
{
static var x:Self { get }
}the Swift compiler will fail to resolve the Self tokens, and Unidoc’s heuristic steps in, replacing Self with S<T>. however, this substitution has no disambiguative value, as it is identical between both extensions.
the client workaround is to avoid Self and spell these extensions using the actual resolved types:
extension S<Int>
{
- static var x:Self { get }
+ static var x:S<Int> { get }
}
extension S<String>
{
- static var x:Self { get }
+ static var x:S<String> { get }
}this would allow documentation to disambiguate between the two overloads with
- ``S.x -> S<Int>``
- ``S.x -> S<String>``in theory, Unidoc could inspect the generic constraints and substitute the type arguments itself. but at this point, we are layering heuristics upon heuristics in order to compensate for what is really a plain old Swift compiler bug.