Open staycoolcall911 opened 1 year ago
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hey @staycoolcall911
I think this issue is close on PR #2391
Thanks @marciocadev ! However, I think this issue is still not fully supported - please see the implementation notes section in the issue description above. For example, this code currently passes compilation:
class A {
x: num;
new(a: num) {
if a == 1 {
this.x = a;
}
}
}
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Community Note
Feature Spec
The compiler now throws an error when a resource
init()
method is not initializing a resource field.For example, consider this wing code:
Compilation should throw an error: "Error at code.w:6:1 | MyResource init failed to initialize field _bucket"
Use Cases
See above.
Implementation Notes
This requires some Control Flow Analysis. We could start with something basic that will not allow conditional initialization (
if
statement) and will simply check that all fields have an initialization statement insideinit()
.Component
Compiler