Tensegritics / Tensegritics/ClojureDart

Dart compiler error when using type annotation inside defrecord

Open
#244 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.6k
Forks
119
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When I try writing the code

(defrecord Model [^int counter])

and then running clj -M:cljd flutter, I get a Dart compiler error:
lib/cljd-out/acme/main.dart:235:45: Error: The argument type 'int' can't be assigned to the parameter type 'V'. final dc.List<V> fl$5=(dc.List<V>.filled(1, counter, ));

The problem persists after clj -M:cljd clean && flutter clean.

To Reproduce
Steps to reproduce the behavior:

  1. Use the project setup described in the ClojureDart README (I got the problem on the latest main, commit f2709454569ca0bc7f666f475fb09293fbb1eb31)
  2. add the line
(defrecord Model [^int counter])

anywhere in src/acme/main.cljd.

  1. run clj -M:cljd flutter

Expected behavior
No compiler errors.

Additional context
I'm trying to use the Elm Architecture in flutter with dartea.

Also thank you all very much for making ClojureDart!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from src/acme/main.cljd using clj -M:cljd flutter, then inspect the generated code around lib/cljd-out/acme/main.dart:235 and the relevant compiler entry points. The issue is done when the ^int annotation in the defrecord compiles without a Dart type error, including after the documented clean commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, dart, flutter
Domain
compilers, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.