Tensegritics / Tensegritics/ClojureDart
Add warning on impossible nil checks
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 1.6k
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
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).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the compiler paths for nil? and some? inlines and the existing specialized handling for boolean contexts where the type is not bool. Trace how nullable and non-nullable types are represented during these checks. Done means the compiler warns whenever it can prove a nil check cannot be true, covering all three cases described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, dart
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100