import strformat
echo &"""<{"total":23}>"""
compiles fine.
The file
import strformat
echo &"""<{"total:":23}>"""
does not compile. The only difference is the colon (:) after total in the second file.
Aren't they both string constants?
The strformat documentation refers to the 'fmt"{expr}"' syntax. Is that a full nim expression, or is more limited? (I didn't see an explanation in in strformat.)
The issue is in strformat, it parses until it hits a colon then it gives what it has to Nim to parse an expression (relevant lines). So the following also fails:
import strformat
type Foo = object
num: int
echo &"""<{Foo(num: 3)}>"""
You can report bugs with the compiler or standard library on the GitHub issue tracker.