You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
new T[a][b] gets length b instead of a (unsound) #557
Description
A multi-dimensional array creation gets the length of its last dimension instead of its first, so wrong programs are accepted (unsound).
Minimal reproducer
importliquidjava.specification.Refinement;
publicclassGrid {
staticvoidrows(int[][] g, @Refinement("_ == length(g)") intn) {}
publicstaticvoidmain(String[] args) {
rows(newint[2][3], 3); // length(g) is 2, should be rejected
}
}
Result on main: Correct! Passed Verification.
Cause RefinementTypeChecker.visitCtNewArray loops over the dimension expressions and keeps the last one (there is a "only working for 1 dimension" TODO there).
Expected length(_) of new T[d1][d2]... is d1. Inner arrays are not modelled, so nothing should be assumed about them. Found while reviewing #540.
Activity