mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Unresolved member lookup is allowed to perform implicit optional unwrap of a base type to find members. Previously if there were any members directly on `Optional`, lookup would stop there. But since SR-13815 it became possible for solver to attempt members found on unwrapped type even if there are viable ones on `Optional` as well. New score kind has been introduced to guard against possible ambiguities with new scheme - `SK_UnresolvedMemberViaOptional`. It's used very time member found via base type unwrap is attempted. Unfortunately, doing so can lead to behavior changes in existing code because it's possible that base was wrapped into optional implicitly based on context e.g. unresolved member passed in as an argument to a parameter of optional type. To fix situations like that, `SK_UnresolvedMemberViaOptional` should only be increased if there is a mix of members to attempt - both directly on `Optional` and on unwrapped type, in all other cases score should stay the same because there could be no ambiguity. Resolves: rdar://73027153
417 KiB
417 KiB