Re: [Vala] Why do regular reference types leak null?



'valac --help' shows an option called '--enable-non-null-experimental'
which might be what you want. I have tried it, but at the moment it
complains about 'glib-2.0.vapi', because many parameters with 'null' as
default value are not marked as nullable.

Excellent. I haven't looked at the Vala code or done a --help in a
while. I was just returning to a project I hadn't worked on in months
when the null thing donned on me again.

The --enable-non-null-experimental runs Vala.NullChecker as a last
stage before code generation. Unfortunately right now all reference
data types have the nullable attribute set to true so
check_compatible() exits before reporting any errors. Reference types
have their nullable set true by the symbol resolver. That must be a
fast and loose fix for development because it really looks like vala
is headed towards static checks. AFAICT, having nullable set correctly
should make this come together.

By commenting out the nullable=true line in the symbol resolver I got
the following warning when trying to assign a Foo? to a Foo.

nullable.vala:8.6-8.7: warning: `Foo?' incompatible with `Foo'

Which is a good sign. Thanks for pointing me in the right direction.

-Sam Danielson



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