Repository navigation
checker: remove unnecessary struct ref field initialization checks and notifications at map initializing(fix #20245) - #20251
Conversation
|
No, please make a fix for the notice for The time for doing this is not now, given that we are still finding edge cases, where the message should not be shown at all. |
|
If we do this now (turn the notice into an error), all it would do is force people to use struct MyStruct {
a &int
b int
}
fn main() {
mut foo := unsafe { map[string]MyStruct{} }
println(foo)
}As you can see, the map is empty. No instances were initialized, and thus no message should be shown. |
|
OK, I see. My main concern is that map creates instances implicitly: struct MyStruct {
a &int
b int
}
fn main() {
mut foo := map[string]MyStruct{}
println((foo['key'].a))
}outputs: I'm going to follow your advice, keep the other "notifications" unchanged, and cancel the "notifications" here, |
Yes, that is true. I think we need another checker notice/error for that, nudging the user to use |
Ok, I'll do it. :) |
…d notifications at map initializing(fix vlang#20245)
0fe5420 to
5aea8bf
Compare
Uh oh!
There was an error while loading. Please reload this page.