semantic/field-void.test \
semantic/floating-reference.vala \
semantic/foreach-iterator-args.test \
+ semantic/foreach-iterator-element-owned.test \
semantic/foreach-iterator-void.test \
semantic/foreach-iterator-wrong-types.test \
semantic/foreach-missing-generic-type.test \
--- /dev/null
+Invalid Code
+
+public class Iterator<G> {
+ public bool next () {
+ return true;
+ }
+
+ public G get () {
+ return (G) null;
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+void main () {
+ Test<string?> test = null;
+ foreach (unowned string? t in test) {
+ }
+}
Invalid Code
+public class Iterator<G> {
+ public bool next () {
+ return true;
+ }
+
+ public G get () {
+ return (G) null;
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
void main () {
- var test = new GLib.List<int> ();
- foreach (string t in test) {
+ Test<string?> test = null;
+ foreach (int t in test) {
}
}