using fwt
class Test : EdgePane
{
private Text mytext
new make()
{
center = EdgePane
{
it.center = mytext = Text
{
it.text = "hallo world"
}
}
}
}
It gives an compile error Non-nullable field mytext must be assigned in constructor make. While it is assigned in the constructor, it seems the compiler does not look inside the it blocks for initializations
brianTue 25 Oct 2011
Promoted to ticket #1676 and assigned to brian
Looks like a hole in the definite assignment checks. Good timing because I also detected this other definite assignment bug:
if (days <= 1) interval = 1min
else if (days <= 8) interval = 10min
else if (days <= 32) interval = 1hr
else throw ArgErr()
brianMon 14 Nov 2011
Ticket resolved in 1.0.61
I fixed a bunch of issues related to definite assignment checks.
If you assign a non-nullable field in a closure, then the compiler no longer reports an error. However, we don't actually have any guarantee that the closure will be run, so we still generate a runtime check. For example:
class Foo
{
new make(Bool c)
{
f := |->| { x = "ok" }
if (c) f()
}
Str x
}
This code above will now compile (previously would have given you a compiler error). However if you try to run Foo(false), then it will correctly raise a FieldNotSetErr.
jessevdam Tue 25 Oct 2011
When I have the following code
It gives an compile error Non-nullable field
mytext
must be assigned in constructormake
. While it is assigned in the constructor, it seems the compiler does not look inside the it blocks for initializationsbrian Tue 25 Oct 2011
Promoted to ticket #1676 and assigned to brian
Looks like a hole in the definite assignment checks. Good timing because I also detected this other definite assignment bug:
brian Mon 14 Nov 2011
Ticket resolved in 1.0.61
I fixed a bunch of issues related to definite assignment checks.
If you assign a non-nullable field in a closure, then the compiler no longer reports an error. However, we don't actually have any guarantee that the closure will be run, so we still generate a runtime check. For example:
This code above will now compile (previously would have given you a compiler error). However if you try to run
Foo(false)
, then it will correctly raise a FieldNotSetErr.