andrewmcveigh / cljs-time

A clj-time inspired date library for clojurescript.
342 stars 57 forks source link

warning when building cljs-time 0.4.0 #57

Closed piranha closed 7 years ago

piranha commented 8 years ago

WARNING: Use of undeclared Var cljs-time.format/constructor at line 413 target/prod.out/cljs_time/format.cljs

piranha commented 8 years ago

That's strange, it happens when I build in advanced mode.

andrewmcveigh commented 8 years ago

Hey,

Thanks for adding the issue, I'm aware of this warning. I think that maybe this is due to a bug in cljs, but not sure ATM.

Do you have any issues with the compiled code working?

arichiardi commented 8 years ago

I noticed that lein cljsbuild once min stops generating the js file.

Moreover with 0.3.15 I have:

Compiling "resources/public/js/compiled/lambdax_web.js" from ["src/cljs" "env/prod/cljs"]...
WARNING: No such namespace: goog.i18n.TimeZone, could not locate goog/i18n/TimeZone.cljs, goog/i18n/TimeZone.cljc, or Closure namespace "" at line 241 /home/kapitan/git/lambdax-web/target/cljsbuild-compiler-1/cljs_time/core.cljs
WARNING: Use of undeclared Var goog.i18n.TimeZone/createTimeZone at line 241 /home/kapitan/git/lambdax-web/target/cljsbuild-compiler-1/cljs_time/core.cljs

Moved to separate issue, not sure if related to this: https://github.com/andrewmcveigh/cljs-time/issues/59

pandeiro commented 8 years ago

We have an app using cljs-time that also started showing this warning when we upgraded to 0.4.0. As our automated builds include a check to fail on any compiler warnings, this makes this version a no-go (though we haven't observed any failures in the compiled output).

If this is a CLJS bug @andrewmcveigh, should we pursue this somehow there?

andrewmcveigh commented 8 years ago

I think there's a cljs/jira issue for this, but I can't find it at the moment.

There's probably a quick work-around that I can put in cljs-time that'd be quicker than diving into the clojurescript compiler. I've been a bit hesitant to do that, but if it's causing people problems then I guess I should.

danielcompton commented 8 years ago

We're wanting to add a 'fail on warn' to our CI but we can't with this warning occurring.

russellwhitaker commented 8 years ago

:+1:

danielsz commented 8 years ago

Any news on this issue? Is the warning indicative of a problem or is it inconsequential?

andrewmcveigh commented 8 years ago

Practically I've not found it a problem, but I've reworked the format stuff in the upcoming 0.5.0, so the code that triggers this warning will not be there. Hoping to get that out this weekend, time/life permitting.

russellwhitaker commented 8 years ago

Thanks @andrewmcveigh . Any chance you might also be here at Clojure/West in Seattle as well this weekend?

danielsz commented 8 years ago

Thank you for the explanation, @andrewmcveigh.

andrewmcveigh commented 8 years ago

@russellwhitaker no, unfortunately not. Bit of a drive from London.

andrewmcveigh commented 8 years ago

Just pushed changes that include a different implementation of the stuff concerned as 0.5.0-alpha1. Would appreciate feedback if this solves (or not) this issue for you.

russellwhitaker commented 8 years ago

@andrewmcveigh thanks for doing that, I'll test it in my own environment in the next day and give feedback here.

danielcompton commented 8 years ago

This fixed the problem for us. Thanks!

arichiardi commented 8 years ago

I don't see the warning as well anymore, thanks a bunch!

danielsz commented 8 years ago

At first glance, it looks good here, too.

andrewmcveigh commented 8 years ago

Thanks for the feedback, I'm going to close this issue then.

yogthos commented 7 years ago

Unfortunately, the problem looks to be back with the lasted ClojureScript releases. Not sure if it's a regression in the compiler though. The errors I see are as follows.

1.9.456

Use of undeclared Var schema.core/RegExp at line 356 target/cljsbuild/public/js/schema/core.cljs

1.9.473

Use of undeclared Var cljs-time/core at line 605 target/cljsbuild/public/js/cljs_time/core.cljs

Everything works fine using 1.9.293 however. I've tested with versions 0.3.14 and 0.5.0-alpha2 of cljs-time.

andrewmcveigh commented 7 years ago

I don't think this can be the same problem, the code that the compiler originally had an issue with is not present in 0.5.x.

I'll re-open though, and check it out.

yogthos commented 7 years ago

This definitely seems to be related to a change in the compiler as downgrading cljs version resolved the issue. This only affects advanced compilation, everything works as expected without optimizations.

danielsz commented 7 years ago

Beyond the warning under optimizations, have you noticed broken calls or other breakage? I'm trying to assess my upgrade strategy towards an application in production that uses cljs-time. I tend to run the latest clojurescript version and the latest cljs-time. Would love to know what kind of damage awaits.

yogthos commented 7 years ago

I haven't done too much testing for that yet. I'll keep you posted if I find anything broken aside from the warnings.

yogthos commented 7 years ago

So I tracked down the issue to bouncer. I thought it might've been the issue that it referenced an older version, but I tried updating it and still see the warnings using it. Nothing really jumps out at me in its implementation though.

andrewmcveigh commented 7 years ago

There has been some change to the compiler recently. There's a "fix" for #89 that should help (7acc22fe827bf9e69a8984ba26becbb774cdc5a4).

It's to do with class-names used in extend-protocol. TBH, I think it could be a bug/regression in the compiler, but I haven't had time to track down the cause.

yogthos commented 7 years ago

That's my suspicion as well since the warnings don't show up using earlier versions on ClojureScript.