This was mistakenly reverted in an attempt to fix bot failures. It
turned out to be a different commit that was responsible, so reapply.
Original commit message was:
We were failing to find init() decls whenever there was more than one
candidate.
The mangled function type we get will be (args...) -> T, but the real
thing is (T.Type) -> (args...) -> T. Strip the metatype so we can match
successfully.
We were failing to find init() decls whenever there was more than one
candidate.
The mangled function type we get will be (args...) -> T, but the real
thing is (T.Type) -> (args...) -> T. Strip the metatype so we can match
successfully.
We have code for pruning unlikely overloads, but when it pruned all
overloads it was treating that as if there was nothing to complete.
Instead, fallback to postfix-expr-begin.
We should also figure out why we're not getting any viable types here,
but we need to handle failure gracefully.
rdar://problem/24356118
Unlike other prefix operators, unary minus is folded into the
NumberLiteralExpr in the parser. This commit recreates this effect in
the lexer-based syntax map so that token ranges will include the leading
minus.
rdar://problem/20205885
Pass through the original Type in addition to the TypeDecl so that we
can distinguish DynamicSelfType with underlying ClassType from just any
old ClassType.
rdar://problem/25158493
We don't actually want to skip non-type contexts here, since we should
only be showing override completions in the type context itself. This
was pretty obscure to hit in practice, but I noticed it while fixing the
crasher.
Add cases to handle basic local variable declarations by looking up the
identifier found in the LocalDeclName. There is some duplication with
Identifier nodes that could be cleaned up still.
The actual lookup is currently dumb - it just attempts to do a
function-wide lookup at the end location of the function body. We'll
need a better way to find the local declarations, but for now it lets us
make some incremental progress.
Make the control flow clearer by factoring out the switch. There was a
single key line burried under there where the node is popped.
Incidentally rename the lonely snake_case parameter to this functiong,
since we're modifying every line anyway.
For now, just tack the testing onto the existing walker that checks the
types. It doesn't seem to work at all for local declarations yet, but
at least we get some top-level stuff.
We generally don't want to override unavailable methods. We already
filter out unavailable decls when completing values, but that's in a
separate visible decl consumer.
rdar://problem/25058233