Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fail to find symbol for a provided object literal #40

Closed
alexeagle opened this issue Aug 26, 2015 · 5 comments
Closed

fail to find symbol for a provided object literal #40

alexeagle opened this issue Aug 26, 2015 · 5 comments

Comments

@alexeagle
Copy link
Contributor

js:

goog.provide('goog.color.names');

goog.color.names = {
    'aliceblue': '#f0f8ff',
    'antiquewhite': '#faebd7'
};

error:

java.lang.IllegalArgumentException: goog.provide not defined: goog.color.names
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
    at com.google.javascript.cl2dts.DeclarationGenerator.produceDts(DeclarationGenerator.java:153)

in the debugger, can see

topScope.getOwnSlot("goog.color") -> Var goog.color{{names: {aliceblue: string, antiquewhite: string}}}
topScope.getOwnSlot("goog.color.names") -> null
topScope.getOwnSlot("goog.color.names.aliceblue") -> Var goog.color.names.aliceblue{string}
@alexeagle
Copy link
Contributor Author

and

topScope.getAllSymbols() ->
...
32 = {TypedVar@2094} "Var goog{null}"
33 = {TypedVar@1633} "Var goog.color{{names: {aliceblue: string, antiquewhite: string}}}"
34 = {TypedVar@1635} "Var goog.color.names.aliceblue{string}"
35 = {TypedVar@2095} "Var goog.color.names.antiquewhite{string}"

@rkirov
Copy link
Contributor

rkirov commented Aug 26, 2015

if "goog.color.names" is missing from symbols, how would a program typecheck for (var c in goog.color.names)?

@alexeagle
Copy link
Contributor Author

note that adding a @type declaration on the declaration fixes this.

@MatrixFrog
Copy link
Contributor

Yeah, just adding that @type seems like it might be a good short-term "fix" though there is likely a compiler-side fix that should eventually happen too.

joeltine pushed a commit to google/closure-library that referenced this issue Aug 27, 2015
@rkirov
Copy link
Contributor

rkirov commented Sep 11, 2015

Closing this one as we "fixed" it by better typing the input Closure code.

@rkirov rkirov closed this as completed Sep 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants