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

Arbitrary undefined constant #27

Open
marceloboeira opened this issue Feb 16, 2016 · 10 comments
Open

Arbitrary undefined constant #27

marceloboeira opened this issue Feb 16, 2016 · 10 comments
Assignees
Labels

Comments

@marceloboeira
Copy link

Example file structure:

src/
--my_lib.cr
--my_lib/
----a.cr
----a/
------b.cr

my_lib.cr

require "./my_lib/**"

module MyLib; end

my_lib/a/b.cr

module MyLib
  class A
    class B
       @example : String
    end
  end 
end

my_lib/a.cr

module MyLib
  class A
    @example : Array(MyLib::A::B)

    def initialize(@another : MyLib::A::B); end
  end 
end

When editing the a.cr file, the plugin generates an syntax error: undefined constant MyLib::A::B

Since probably the plugin is trying to compile/check the syntax only on this specific file, it is not able to find the reference to the class.

If I require my_lib/a/b.cr everything works well. Yet, on my_lib.cr all the files are required.

But the weirdest of all, is that this error does not occur on the initialize method reference to MyLib::A::B.

@rhysd rhysd added the bug label Feb 21, 2016
@rhysd rhysd self-assigned this Feb 21, 2016
@rhysd
Copy link
Member

rhysd commented Feb 21, 2016

@marceloboeira

Sorry for the delay of response. I had a business trip last week.
Thank you for detailed explanation. I understood what had occurred.

Let me ensure: are you using syntastic?

@marceloboeira
Copy link
Author

@rhysd no problem. Yes I'm using it.

@rhysd
Copy link
Member

rhysd commented Feb 22, 2016

@marceloboeira

I fixed this in 888bc4a. Could you confirm the latest?

@marceloboeira
Copy link
Author

@rhysd thanks, I'll take a look

@rhysd
Copy link
Member

rhysd commented Feb 27, 2016

@marceloboeira ping

@marceloboeira
Copy link
Author

@rhysd sorry, I was busy with some work stuff this week. I just checked here and the problem remains.

@rhysd
Copy link
Member

rhysd commented Mar 1, 2016

Sorry, I didn't intend to hurry you up 💦

Thank you for the confirmation. Hmm... I'll check it with your reported file structure again.

@marceloboeira
Copy link
Author

@rhysd no worries.

@will
Copy link

will commented Apr 24, 2016

I have a similar problem, but it's "already defined constant". Even just a single file with a constant triggers it for me. Up to date on vim-crystal and syntastic http://showterm.io/2c722b79bd5e92090d327

edit: to add that I see "already defined constant"

@SeanFelipe
Copy link

SeanFelipe commented Aug 27, 2020

I'm seeing this issue today in a Lucky database config file I just brought up. Using Crystal for the first time.

I'm following this tutorial:
https://onchain.io/blog/lucky_tutorial

However when I open up config/database.cr I see an error from ALE on the first line. See screenshot ... thanks :)

ps. vim 8.1.2292, using ALE asynchronous checker. Maybe I'll switch back to Syntastic..

Screen Shot 2020-08-26 at 5 06 11 PM

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

No branches or pull requests

4 participants