GNOME Bugzilla – Bug 744797
Using foreach requires (!) operator
Last modified: 2018-05-22 15:21:21 UTC
Compiling this with experimental non-null enabled: void main () { var array = new Variant.parsed ("[1, 2, 3]"); foreach (var item in array) { print ("%d", item.get_int32 ()); } } Results in: fail.vala:5.16-5.29: error: Access to instance member `GLib.Variant.get_int32' from nullable reference denied print ("%d", item.get_int32 ()); ^^^^^^^^^^^^^^ Compilation failed: 1 error(s), 0 warning(s) But it shouldn't be necessary since item can't be null. The iterator interface stops when next_value() returns null, and get() returns T, not T?.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/489.