Also, begin to pass around base types instead of raw InOutType types. Ideally, only Sema needs to deal with them, but this means that a bunch of callers need to unwrap any inouts that might still be lying around before forming these types.
Multiple parts of the compiler were slicing, dicing, or just dropping these flags. Because I intend to use them for the new function type representation, I need them to be preserved all across the compiler. As a first pass, this stubs in what will eventually be structural rules as asserts and tracks down all callers of consequence to conform to the new invariants.
This is temporary.
Part of the fix-it for conversion from optional to raw representable
was inserted at the incorrect position which produces invalid expression.
Resolves: rdar://problem/32431736
Now that we remember the DeclContext of lookup results when
doing unqualified lookup, we don't have to walk parent contexts
again to find this DeclContext.
This means that unqualified lookup is now the "single source of
truth" for what names are visible and why.
The distinction was made between these two because of rdar://25341015,
wherein we needed a diagnostic that could detect the shadowing of
global functions by calls in protocols that don't match any
of the protocol's members.
This used to function by hoping that we had an argument tuple type lying
around after type checking. The expr cleaner would re-write that
type into the AST and we would look up based on it. Now that we write
Type() into the AST on failure, we must instead type check the
component parts of the argument themselves to form a tuple
type to make the lookup.
Cuts off a crash in SILGen for switches over uninhabited types.
We can take this a step further and extend the definition of
"uninhabited" to product types with uninhabited components.
and a CSApply bug with variadic tuple subscripts that I did not.
The SILGen bug was exposed by the source-compat test suite as part
of rdar://33341584.
In the type checker, we need to recognize when a member lookup succeeded through an IUO unwrap, and insert the implicit optional-unwrap component into the key path. In the standard library, we need to cope with the fact that IUO is still a first-class type with unique type metadata in a few places. Fix for rdar://problem/33230845.
Doing this allows us to return ErrorType in some circumstances where we
want to communicate that we don't have a usable type rather than writing
ErrorType directly into the type of the expression root, avoiding a
mutation of the expression tree in a failure case.
When we saw lvalue- or inout-types we were not appropriately looking at
the underlying types when performing a join. As a result we would infer
Any in cases where we should have inferred a common supertype.
rdar://problem/31127419
There are two "RAII cleaners" here:
- CleanupIllFormedExpressionRAII cleans up the Expr in its final state
- ExprCleanser walks the Expr before it is mutated and collects
sub-expressions, then cleans those up after
The subtle difference comes into play if we started to apply the
solution (which can fail, leaving the AST in an inconsistent state)
or if preCheckExpression() modified the AST.
The latter case was causing an ASan failure because we were not
cleaning up type variables in new nodes introduced by
preCheckExpression().
Fix this by moving the preCheckExpression() call out of
solveForExpression(), so that if solveForExpression() is called
with TypeCheckExprFlags::SkipApplyingSolution, we don't mutate the
AST at all.
Sigh...
Fixes <rdar://problem/33277279>.
Specifically, it uses SerializedASTFile::getLanguageVersionBuiltWith
to improve diagnostics. Not having this has led to failures on Linux,
where linking order matters.
Some types and members are synthesized by derived protocol conformances
(e.g. the CodingKeys member type or init(from:)/encode(to:) members
from Decodable/Encodable conformance) — however, they are not visible
in AST lookup if they have not been synthesized.
Exposes a LazyResolver callback for performing member synthesis where
relevant during qualified lookups to synthesize these members on demand
when needed.