Skip to content

Commit

Permalink
Fix population of interface signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Oct 17, 2024
1 parent e0426ea commit a333301
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 36 deletions.
38 changes: 2 additions & 36 deletions src/orchestrator/populator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,42 +741,8 @@ fn inherit_methods_from_parent(
}
}

if let Some(existing_declaring_class) = storage.declaring_method_ids.get(method_name) {
if existing_declaring_class != declaring_class {
let existing_declaring_class_storage = if existing_declaring_class == &storage.name
{
&storage
} else if let Some(storage) = codebase.classlike_infos.get(existing_declaring_class)
{
storage
} else {
continue;
};

if !matches!(existing_declaring_class_storage.kind, SymbolKind::Interface) {
if let Some(functionlike_storage) = codebase
.functionlike_infos
.get(&(existing_declaring_class_storage.name, *method_name))
{
if let Some(method_info) = &functionlike_storage.method_info {
if !method_info.is_abstract {
continue;
}

if let Some(functionlike_storage) = codebase
.functionlike_infos
.get(&(storage.name, *method_name))
{
if let Some(method_info) = &functionlike_storage.method_info {
if method_info.is_abstract {
continue;
}
}
}
}
}
}
}
if let Some(_) = storage.declaring_method_ids.get(method_name) {
continue;
}

storage
Expand Down
15 changes: 15 additions & 0 deletions tests/inference/Interface/refineInterfaceThenCall/input.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface I {
public function foo(): arraykey;
}

interface IChild extends I {
public function foo(): string;
}

function bar(I $i): string {
if ($i is IChild) {
return $i->foo();
} else {
return '';
}
}

0 comments on commit a333301

Please sign in to comment.