We're updating the issue view to help you get more done. 

Non-sensical destructuring fails with surprising error message

Description

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 user=> (let [{:keys [foo]} 3] foo) Syntax error (UnsupportedOperationException) compiling at (REPL:1:1). Can't type hint a primitive local user=> *1 nil user=> *e #error { :cause "Can't type hint a primitive local" :via [{:type clojure.lang.Compiler$CompilerException :message "Syntax error compiling at (1:1)." :data #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "NO_SOURCE_PATH"} :at [clojure.lang.Compiler analyze "Compiler.java" 6808]} {:type java.lang.UnsupportedOperationException :message "Can't type hint a primitive local" :at [clojure.lang.Compiler$LocalBindingExpr <init> "Compiler.java" 6015]}] :trace [[clojure.lang.Compiler$LocalBindingExpr <init> "Compiler.java" 6015] [clojure.lang.Compiler analyzeSymbol "Compiler.java" 7297] [clojure.lang.Compiler analyze "Compiler.java" 6768] [clojure.lang.Compiler analyze "Compiler.java" 6745] [clojure.lang.Compiler$InvokeExpr parse "Compiler.java" 3888]

Not sure what my expected behaviour here would be, but if an error is to be raised, I'd expect an error message saying something like 'It doesn't make sense to destructure a number'

For info, this is caused by applying the type-hint here

which is no longer needed, since we call `seq` on `gmap` here

FWIW the same code runs and compiles without errors in Clojurescript

Environment

None

Status

Assignee

Unassigned

Reporter

Erik Assum

Labels

None

Approval

None

Patch

Code

Priority

Minor