Skip to content

Commit

Permalink
Fix transitive check
Browse files Browse the repository at this point in the history
Summary:
Fix transitive checking of stubs.

It is not sound to assert that a reference is valid if it has already been visited, because the whole cycle may prove to be invalid later on.

The proposed fix is to store "maybe invalid" references (those that have already been visited), and resolve them at once at the end, once information from non-recursive branches has been propagated.

Reviewed By: ilya-klyuchnikov

Differential Revision: D60903935

fbshipit-source-id: 46102b7583f1b98cdc081803cce97dcfe44e17da
  • Loading branch information
VLanvin authored and facebook-github-bot committed Aug 8, 2024
1 parent b9518a7 commit 3f6c22b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Util.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,9 @@ class Util(pipelineContext: PipelineContext) {
.map(applyType)
.getOrElse({
if (pipelineContext.module == remoteId.module) {
// TODO: remove failsafe after T172093135
DbApi.getPrivateOpaque(module, id) match {
case Some(ty) => applyType(ty)
case None => DynamicType
}
applyType(DbApi.getPrivateOpaque(module, id).get)
} else {
if (!DbApi.getPrivateOpaque(remoteId.module, id).isDefined) {
DynamicType
}
assert(DbApi.getPrivateOpaque(remoteId.module, id).isDefined, s"could not find $remoteId from $module")
OpaqueType(remoteId, args)
}
})
Expand Down

0 comments on commit 3f6c22b

Please sign in to comment.