Tensegritics / Tensegritics/ClojureDart
Case statement fails when used with a variable
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 1.6k
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
Case statement fails when used with a variable with the following error:
Execution error (AssertionError) at cljd.compiler/emit-case* (compiler.cljc:1600).
Assert failed: (and (symbol? expr) (env expr))
ClojureDart version: 1e38014dcb93dcdb230d125c7d0966556a82d234
Examples:
;; OK
(case :ios
:ios "iOS"
:android "Android"
"not implemented") => "iOS"
(defn case-test
[os]
(case os
:ios "iOS"
:android "Android"
"not implemented"))
(case-test :ios) => "iOS"
;; ERROR
(def os :ios)
(case os
:ios "iOS"
:android "Android"
"not implemented") => Execution error...
(let [the-os :ios]
(case the-os
:ios "iOS"
:android "Android"
"not implemented")) => Execution error...
Currently working around this by using condp.
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 at compiler.cljc:1600, where the reported assertion occurs, and compare the working literal and function-argument cases with the failing def and let examples. Verify the change against all supplied examples; done means case works with variable bindings without the assertion while the existing literal case remains working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100