typetools / typetools/checker-framework
When exiting a scope, dependent type annotations should no longer refer to its variables
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Consider the following code:
{
int a = 0;
{
int b = ...;
a = b-1;
// `a` now has type @LessThan("b"). This is fine.
}
// BUG: `a` still has type LessThan("b").
{
int b = ...
// `a` still has type LessThan("b") here, which might not be a true relationship!
}
}
When exiting a scope, type annotations need to be adjusted.
- One approach would be to go through all types in the store and remove references to variables that are going out of scope.
- A simpler approach would be to re-standardize (or re-parse all dependent type Java expressions), and drop any such that yields an error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the scope-exit handling and type store described in the issue, then reproduce the nested-scope example. The work is done when dependent type annotations no longer refer to variables that have left scope, including preventing the later block from reusing the stale relationship.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100