Skip to content

Commit

Permalink
Actually use unpacked constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Aug 19, 2024
1 parent a28879a commit 8c560d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/analyzer/expr/binop/arithmetic_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub(crate) fn analyze<'expr: 'tast, 'tast>(
..
} = &e1_type_atomic
{
e1_type_atomic = e1_type_atomic.clone();
e1_type_atomic = (**constraint).clone();
}

if let TAtomic::TFalse = e1_type_atomic {
Expand Down Expand Up @@ -145,7 +145,7 @@ pub(crate) fn analyze<'expr: 'tast, 'tast>(
..
} = &e2_type_atomic
{
e2_type_atomic = e2_type_atomic.clone();
e2_type_atomic = (**constraint).clone();
}

if let TAtomic::TFalse = e2_type_atomic {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum Foo: int as int {
BAR = 1;
BAZ = 2;
}

final class A {
const int FOO = Foo::BAR;
}
3 changes: 3 additions & 0 deletions tests/inference/Constant/classConstantValueOfEnum/input.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function add(int $i): int {
return A::FOO + 1;
}

0 comments on commit 8c560d3

Please sign in to comment.