HoriSun / closure-compiler

Automatically exported from code.google.com/p/closure-compiler
0 stars 0 forks source link

@enum does not type correctly #482

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. create an enum with any syntax
my example:
/** 
@type {Object}
*/
var NS = {};

/**
@enum {number}
*/
NS.keys = { 
    a: 1, 
    b: 2, 
    c: 3
};

/**
@enum
*/
window['gKEYS'] = NS.keys;

2. complie with --compilation_level ADVANCED_OPTIMIZATIONS 
--summary_detail_level 3 --warning_level VERBOSE

3. look at the % typed

What is the expected output? What do you see instead?
it shouldn't count the enum as un-typed; it does...

What version of the product are you using? On what operating system?
Version: 1043
Built on: 2011/05/02 19:47

Please provide any additional information below.

i also tried to tersely coerce the type, eg:
/** @type {number} */ a:  (/** @type {number} */(1)),

which has no effect.

Original issue reported on code.google.com by Kozlowsk...@gmail.com on 6 Jun 2011 at 1:59

GoogleCodeExporter commented 9 years ago
Thanks for pointing this out.

Yi Zhu found that the problem is the name string node 'a', 'b', 'c' has no type.

I personally think it doesn't really matter what we type we give those nodes: 
number or the proper EnumValueType make sense. Alternatively we can just not 
count those in the % type tally.

Original comment by acle...@google.com on 7 Jun 2011 at 8:42

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1167.

Original comment by `` on 9 Jun 2011 at 6:46