Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
Summary:
A bit of clarification in the hack schema to address user questions.

The "override" semantics isn't properly specified. There's no documentation where we can point to.

The indexer uses this [method](https://www.internalfb.com/code/fbsource/[b35bdae4ad9f]/fbcode/hphp/hack/src/providers/decl_provider.mli?lines=68). There are some edge cases, for instance, a trait method can override an interface method, but a class method doesn't.   See also D63282603.

Reviewed By: josefs

Differential Revision: D63415167

fbshipit-source-id: e65363239e08f584d1bf9f930fd18fbfdecb3137
  • Loading branch information
Philippe Bidinger authored and facebook-github-bot committed Sep 26, 2024
1 parent 2f60958 commit 17396e5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions glean/schema/source/hack.angle
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ predicate MemberCluster :
members : [Declaration]
}

# All declarations in a container coming from a parent class (recursively)
# or a trait. Doesn't include the declarations that directly defined
# in the container. Members are grouped in clusters for storage efficiency.
predicate InheritedMembers :
{
container : ContainerDeclaration,
Expand Down Expand Up @@ -769,8 +772,10 @@ predicate ModuleChild:
decl : hack.Declaration
} stored { Module, Decl } where hack.ModuleParent { Decl, Module }

# Class methods implementation of an interface aren't considered as override.
# However, the methods introduced by `use T` can override interface methods.
# Generally, method "derived" overrides "base", if "derived" would have been inherited
# in case where "base" wasn't defined.
# Note that class methods implementing interface aren't considered as override, but
# trait methods can override interface methods.
predicate MethodOverrides :
{
derived : MethodDeclaration,
Expand Down

0 comments on commit 17396e5

Please sign in to comment.