Instead of special casing argument-to-parameter matching for
object literal expressions, let's allow constraint system to
lookup a witness initializer and apply it to the given set
of arguments.
This also simplifies constraint application because
`coerceCallArguments` could be used to form type-checked
argument expression.
If aggregate fix (based on callee locator) differs only in picked
overload choices, let's diagnose that via `diagnoseForAmbiguity`
associated with a particular fix kind all solutions share, that
would produce a tailored diagnostic instead of the most general one.
Refactor `diagnoseAmbiguityWithFixes` as follows:
- Aggregate all of the available fixes based on callee locator;
- For each ambiguous overload match aggregated fixes and diagnose;
- Discard all of the fixes which have been already considered
as part of overload diagnostics;
- Diagnose remaining (uniqued based on kind + locator) fixes
iff they appear in all of the solutions.
- `getCalleeLocator`, if given locator ends at `ArgumentAttribute`
strip the last element which makes sure that produced locator
always refers directly to argument-to-parameter conversion.
- `simplifyLocator`, always leave `ArgumentAttribute` in the path
because it's useful for diagnostics.
The parser used to rewrite
if let x: T
into
if let x: T?
This transformation is correct at face value, but relied on being able
to construct TypeReprs with bogus source locations. Instead of having
the parser kick semantic analysis into shape, let's perform this
reinterpretation when we resolve if-let patterns in statement
conditions.
Previously we would always consider an AnyObject
subscript lookup to be ambiguous if there was a
candidate in both a class and protocol, even if
the selectors and types matched. This was due to
the protocol's generic signature preventing the
signatures from being coalesced.
Tweak the logic to strip generic signatures when
comparing for AnyObject lookup, matching what we
do for @objc methods.
Resolves SR-8611.
Resolves rdar://43645564 & rdar://62906344.
Key path dynamic member lookup should be completely transparent
for simplification purposes, it's just a means to get to the current
overload choice.
Resolves: rdar://problem/62989214
Annotate the covered switches with `llvm_unreachable` to avoid the MSVC
warning which does not recognise the covered switches. This allows us
to avoid a spew of warnings.
Now that these are stored in the TypeResolution object itself, and all callers that mutate flags create a new resolution object, this data can be derived from the resolution itself.
Add the appropriate assertions to ensure that the now-redundant options parameters are being kept in sync so they can be retracted.
The eventual goal is to have TypeResolution requestified.
All callers can trivially be refactored to use ModuleDecl::lookupConformance()
instead. Since this was the last flag in ConformanceCheckOptions, we can remove
that, too.