Arbitrary `undefined constant`
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.
@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?
@rhysd no problem. Yes I'm using it.
@marceloboeira
I fixed this in 888bc4a. Could you confirm the latest?
@rhysd thanks, I'll take a look
@marceloboeira ping
@rhysd sorry, I was busy with some work stuff this week. I just checked here and the problem remains.
Sorry, I didn't intend to hurry you up :sweat_drops:
Thank you for the confirmation. Hmm... I'll check it with your reported file structure again.
@rhysd no worries.
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"
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..