-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[inferhack] test showing FP in uninitialised constants
Reviewed By: davidpichardie Differential Revision: D62766490 Privacy Context Container: L1208441 fbshipit-source-id: 53d866a310a7c27c6cc6424c259c52f713109be9
- Loading branch information
1 parent
c1bd05a
commit 253d7a2
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
infer/tests/codetoanalyze/hack/pulse/abstractconstants.hack
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,38 @@ | ||
// 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. | ||
|
||
// check we resolve constants in the right order | ||
|
||
namespace AbstractConstants; | ||
|
||
abstract class C { | ||
abstract const int MyC; | ||
} | ||
|
||
interface I { | ||
const int MyC = 1; | ||
} | ||
|
||
trait T { | ||
const int MyC = 2; | ||
} | ||
|
||
class D extends C implements I { | ||
|
||
} | ||
|
||
class E extends C { | ||
use T; | ||
} | ||
|
||
class Tester { | ||
public static function constant_from_interface_FP(): void { | ||
D::MyC; | ||
} | ||
|
||
public static function constant_from_trait_OK(): void { | ||
E::MyC; | ||
} | ||
} |
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