Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The if condition was marked as systematically inconstant. This was not often problematic since most of the time this means that the if is eliminated by simplify. But this is not the case in let rec's where the approximation of the value is not known by simplify. But the problem is noticeable in this example type t = A | B of (int -> int) let p = 1 + 1 let rec b = B g and g n = let b' = b in match b' with | A -> n + p | B f -> f n The inconstant_ident pass correctly identifies b and g as constants, but marks b' as inconstant due to this bug (because match on this kind of type is compiled as an if). When lifting the definition of g into a let_rec_symbol, the alias_analysis does not keep the alias of b' to b because b' is considered as inconstant. Hence no substitution is applied to it. This leads to building a closed function with free variables, which is obviously wrong.
- Loading branch information