Skip to content

Commit e777b99

Browse files
committed
Always enlarge resolved constant types
1 parent ddd2e14 commit e777b99

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/code_info/ttype/type_expander.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,15 @@ fn expand_atomic(
343343
FxHashSet::default(),
344344
);
345345

346-
if let Some(const_type) = const_type {
346+
if let Some(mut const_type) = const_type {
347+
expand_union(
348+
codebase,
349+
interner,
350+
&mut const_type,
351+
options,
352+
data_flow_graph,
353+
);
354+
347355
new_return_type_parts.extend(const_type.types);
348356
} else {
349357
new_return_type_parts.push(TAtomic::TMixed);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
enum M: int as int {
2+
A = 0;
3+
B = 1;
4+
C = 2;
5+
D = 3;
6+
E = 4;
7+
}
8+
9+
const keyset<M> FOO = Bar::FOO;
10+
11+
final class Bar {
12+
const keyset<M> FOO = keyset[M::A, M::C, M::E];
13+
}
14+
15+
function baz(M $i): void {
16+
if (C\contains(FOO, $i)) {}
17+
}

0 commit comments

Comments
 (0)