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
…986)
Currently, enhanced-for-loops do not honor nullability annotations on
arrays.
**Current Behavior**
Both these dereferences work fine.
```
static @nullable String[] fizz = {"1"}
for (String s: fizz){
s.toString();
if (s!=null){
s.toString();
}
}
```
**New Behavior**
The first one throws an error, as expected.
```
static @nullable String[] fizz = {"1"}
for (String s: fizz){
// BUG: Diagnostic contains: dereferenced expression s is @nullable
s.toString();
if (s!=null){
s.toString();
}
}
```
Fixes#983
See test case
forEachLoop()
in #982. We don't properly reason that when the array contents are@Nullable
the for-each loop variable is@Nullable
.The text was updated successfully, but these errors were encountered: