[SR-4660] Methods on self should not block unambiguous calls to free functions #47237
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: 12281a4d9a9ecf365a324aadbc5ac15d
duplicates:
relates to:
Issue Description:
If you have a method on
self
with the same basename, the compiler will refuse to let you call free functions without full qualification, even when the call is unambiguous due to an argument labels, arity, types etc. This makes for a frustrating user experience, and requires workarounds for source compatibility when introducing methods that shadow existing functions.Most prominent case is calling
max
passing in two arguments inside an extension on aSequence
(which has a no-argumentmax
function). Even though it's not ambiguous, you have to writeSwift.max
which is ugly and hard for new users to discover.The text was updated successfully, but these errors were encountered: