You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys! Not sure how hard this would be to fix, but I thought I would bring it up.
//produces compiler warningclassC1 {
valx= y
valy=1
}
//no warning :(classC2 {
valx= getY
valy=1defgetY= y
}
//no warning either :(traitT {
valy:Intvalx:Int= y
}
classC3extendsT {
valy=1
}
This is a really easy thing to do accidentally if you're moving things around and it can lead to a class that throws a NullPointerException whenever it is instantiated.
Related - #221
IMO it would be better to produce an error than a warning in general, especially since classes/strings/collections/misc non-Int values default to null, which seems to run very counter to the spirit of Scala. ¯\_ (ツ) _/¯
The text was updated successfully, but these errors were encountered:
this has been an area of active discussion over the years — you might look for related tickets in scala/bug. it is a difficult design and implementation problem. I doubt anything further will change in this area in Scala 2. not sure what the current status over in lampepfl/dotty is
Hey guys! Not sure how hard this would be to fix, but I thought I would bring it up.
This is a really easy thing to do accidentally if you're moving things around and it can lead to a class that throws a NullPointerException whenever it is instantiated.
Related - #221
IMO it would be better to produce an error than a warning in general, especially since classes/strings/collections/misc non-Int values default to null, which seems to run very counter to the spirit of Scala. ¯\_ (ツ) _/¯
The text was updated successfully, but these errors were encountered: