Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readable symbol links #83

Merged
merged 1 commit into from
Jan 2, 2025
Merged

readable symbol links #83

merged 1 commit into from
Jan 2, 2025

Conversation

tayloraswift
Copy link
Owner

@tayloraswift tayloraswift commented Jan 2, 2025

this eradicates all but one hash-disambiguated symbol link from this package’s documentation by using type signature based disambiguation instead.

the one remaining holdout is the Int.init(_:) method, which Int inherits from SignedInteger. this link collides with a similar method on FixedWidthInteger which also uses the name T for its generic parameter, albeit with completely different generic constraints.

error: selector 'Int.init(_:) (T)' is ambiguous

Since we just want to cast the grayscale samples directly to index values, we don’t need the palette parameter, so we discard it with the `_` binding. We then return the ``Int.init(_:) (T)`` initializer, which casts the grayscale samples to ``Int``s.
                                                                                                                                                                              ~~~~~~~~~~~~~~~^

note: did you mean 'Int.init(_:) [4EKVL]'? ((extension in Swift):Swift.SignedInteger< where A: Swift.FixedWidthInteger>.init<A where A1: Swift.BinaryInteger>(A1) -> A)
note: did you mean 'Int.init(_:) [6GT9Z]'? ((extension in Swift):Swift.FixedWidthInteger.init<A where A1: Swift.BinaryFloatingPoint>(A1) -> A)
note: did you mean 'Int.init(_:) (Float16) -> ()'? (Swift.Int.init(Swift.Float16) -> Swift.Int)
note: did you mean 'Int.init(_:) (NSNumber) -> ()'? ((extension in Foundation):Swift.Int.init(Foundation.NSNumber) -> Swift.Int)
note: did you mean 'Int.init(_:) (Float) -> ()'? (Swift.Int.init(Swift.Float) -> Swift.Int)
note: did you mean 'Int.init(_:) (CGFloat) -> ()'? ((extension in Foundation):Swift.Int.init(Foundation.CGFloat) -> Swift.Int)
note: did you mean 'Int.init(_:) (Double) -> ()'? (Swift.Int.init(Swift.Double) -> Swift.Int)
note: did you mean 'Int.init(_:) (Float80) -> ()'? (Swift.Int.init(Swift.Float80) -> Swift.Int)
note: did you mean 'Int.init(_:) (String) -> ()'? ((extension in Swift):Swift.FixedWidthInteger.init(Swift.String) -> Swift.Optional<A>)

i worked around this by spelling out Int’s ``SignedInteger/init(_:)`` in English, but this is a little icky.

@tayloraswift tayloraswift merged commit 3f8b072 into master Jan 2, 2025
8 checks passed
@tayloraswift tayloraswift deleted the readable-symbol-links branch January 2, 2025 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant