Tensegritics / Tensegritics/ClojureDart
Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
Open
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 1.6k
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
When binding a nullable Function property inference should remove the?
(when-some [cb (-> (m/ContextMenuButtonItem .onPressed nil) .-onPressed)]
(cb))
will generate
final void Function()? some$6054_$AUTO_$1=const f_material.ContextMenuButtonItem(onPressed: null, ).onPressed;
if((null == some$6054_$AUTO_$1)){
return null;
}
final void Function()? cb$1=some$6054_$AUTO_$1;
return cb$1();
Which throws at compile time
Try calling using ?.call instead.
Performing hot reload...
return cb$1();
^
Try again after fixing the above error(s).
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
Reproduce the Clojure expression and inspect the generated Dart shown in the issue, focusing on nullable Function binding and the resulting call. Start by tracing how this expression is compiled, then verify that the generated output compiles and that the nullable callback case no longer produces the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100