forked from facebook/infer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[inferhack] add cycle detection to type constant expansion in check_a…
…gainst_type_structure Reviewed By: jvillard Differential Revision: D61140300 fbshipit-source-id: 99a5b93cab46ccfc7d834b5551c3bab0ba378f29
- Loading branch information
1 parent
826fd3f
commit bcdb703
Showing
2 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
infer/tests/codetoanalyze/hack/pulse/cyclicconstants.badhack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
// this file doesn't typecheck so can't be checked in as part of our normal test suite | ||
// but running it manually allows testing the "should never happen" loop detection code | ||
// so we give it the extension .badhack | ||
namespace Cyclic; | ||
|
||
class C { | ||
const type T = D::T; | ||
} | ||
|
||
class D { | ||
const type T = C::T; | ||
|
||
public static function looper(mixed $m): int { | ||
if ($m is C::T) { | ||
return 42; | ||
} | ||
return 0; | ||
} | ||
} |