Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crash on ::alias/kw #619

Open
grayrest opened this issue Feb 23, 2025 · 3 comments
Open

Compiler crash on ::alias/kw #619

grayrest opened this issue Feb 23, 2025 · 3 comments

Comments

@grayrest
Copy link
Contributor

version

main branch a483222

problem

(ns foobar
  (:require [clojure.set :as set]))

#_(str ::set/foobar)

Crashes the compiler with the error:

Alias `set` not found in `:auto-resolve`

expected behavior

I'm kind of surprised that name resolution is happening in #_ forms but crashing on the ::alias/kw is the main issue. I can tell it's an edamame error but I'm filing it here in case the issue is a configuration option. I tried turning on auto-resolve in the squint-options and that didn't fix things so I decided to just report it.

@borkdude
Copy link
Member

borkdude commented Feb 26, 2025

#_ is always processed in clojure with respect to aliasing even if it's not used. It's not clear to me in the expected behavior section what is the desired outcome, you only describe stuff you tried.

Can you provide more information on how you ran into this problem, with the console REPL or the online playground? I do see why that might be the case there. In the normal command line compiler process it should already work I think.

@grayrest
Copy link
Contributor Author

As a user I generally associate compiler crashes with something the compiler is doing wrong and not something that I am doing wrong so I'd like alias resolution errors to be caught and communicated as an error from the compiler (i.e. my code is at fault) and not from edamame (i.e. compiler isn't working).

I ran into this while trying to get an existing project working purely in compiled mode. When writing up this ticket I used the online repl to try to get a reduced test case and the online playground crashes with the code at the top. So when I wrote up the ticket I thought namespaced keywords were generally broken.
I just double-checked that assumption and had one work, so from the top:

  • I thought that #_ was just another way to write a comment and didn't know about the ns-resolution
  • Non-existing aliases crash the compiler ((println ::crashme/foo))
  • Code in the original post crashes the online repl
  • ns keywords are working otherwise.

The specific code that triggered the problem for me was (assert (s/valid? ::calculator-model/clause... and I have spec commented out so it looks like the problem was with the spec alias and not the keyword. I ran into the repl issue while writing up this ticket and got the root problem wrong.

@borkdude
Copy link
Member

I'm still not 100% sure what you want me to do with this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants