-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Labels
flow-analysisDiscussions about possible future improvements to flow analysisDiscussions about possible future improvements to flow analysisquestionFurther information is requestedFurther information is requested
Description
We have the following rule:
- try catch: If
N
is a try/catch statement of the formtry B alternatives
then:
- Let
before(B) = before(N)
- For each catch block
on Ti Si
inalternatives
:
- Let
before(Si) = conservativeJoin(before(N), assignedIn(B), capturedIn(B))
- Let
after(N) = join(after(B), after(C0), ..., after(Ck))
The static analysis function conservativeJoin
receives information about variables which are assigned in B
and variables which are write-captured in B
, both as raw occurrences with no considerations about the control flow, but it doesn't receive any information about types of interest.
This seems to imply that no types of interest established by code in the try
block are taken into account during the analysis of the catch
clauses, or even the code after the try
-catch
statement.
A similar situation seems to exist for the try
-finally
statement.
However, the implemented behavior seems to be different. It does take such types of interest into account, at least in some cases:
main() {
num i = 1 as dynamic;
try {
i as int;
} catch (_) {}
i = 1;
i.isEven; // OK.
}
Metadata
Metadata
Assignees
Labels
flow-analysisDiscussions about possible future improvements to flow analysisDiscussions about possible future improvements to flow analysisquestionFurther information is requestedFurther information is requested