Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/code_info_builder/typehint_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ pub fn get_type_from_hint(
let base = match hint {
Hint_::Happly(id, extra_info) => {
let applied_type = &id.1;
let applied_type_str = applied_type
.strip_prefix('\\')
.unwrap_or(applied_type.as_str());

if let Some(resolved_name) = resolved_names.get(&(id.0.start_offset() as u32)) {
if let Some((_, type_name)) = type_context
Expand All @@ -521,7 +524,7 @@ pub fn get_type_from_hint(
}
}

match applied_type.as_str() {
match applied_type_str {
"int" => TAtomic::TInt,
"string" => TAtomic::TString,
"arraykey" => TAtomic::TArraykey { from_any: false },
Expand Down Expand Up @@ -664,7 +667,7 @@ pub fn get_type_from_hint(
}
"resource" => TAtomic::TResource,
"_" => TAtomic::TPlaceholder,
"HH\\FIXME\\MISSING_RETURN_TYPE" | "\\HH\\FIXME\\MISSING_RETURN_TYPE" => {
"HH\\FIXME\\MISSING_RETURN_TYPE" => {
return None;
}
_ => get_reference_type(
Expand Down
13 changes: 13 additions & 0 deletions tests/inference/FunctionCall/aliasedArgumentType/input.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace A;

function foo(mixed $test): void {
if ($test is \HH\Awaitable<_>) {
\HH\Asio\join($test);
}
}

function bar(mixed $test): void {
if ($test is Awaitable<_>) {
Asio\join($test);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@