Tensegritics / ClojureDart

Clojure dialect for Flutter and Dart
1.38k stars 88 forks source link

Add warning on impossible nil checks #279

Open cgrand opened 9 months ago

cgrand commented 9 months ago

It's common, especially when porting CLJ code, to forget to make some type nullable. The error is generally only caught at runtime. Here I propose to add a warning every time the compiler can detect a nil check will never be true, this will help spot the error at compile time.

This includes inlines of nil? and some? but also boolean contexts where the type is not bool and which is thus only a nil check (we already have specialized code for that).