Re: [Vala] What is correct solution to warning: 'null ' incompatible with 'SomeType'?



Levi Bard <taktaktaktaktaktaktaktaktaktak    > writes:
   Shell.vala:112.13-112.24: warning: `null' incompatible with return type
   `Guitcore.Task`
           return null;
           ^^^^^^^^^^^^

Try making the return type of the method "Guitcore.Task?" (the ?
signifies that the type is nullable).
http://live.gnome.org/Vala/FAQ#head-7c7455d22d2055a29e8d025d4785f59452ae81e6

Thanks. It silences the warning.

I somewhat assumed it is only used with value types (like in C#) and didn't
think about using it in this case. But it makes good sense as annotation, that
a particular function should be expected to sometimes return null.

Best regards,
Jan






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]