This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 401380 - [bug] must be a number false warning
Summary: [bug] must be a number false warning
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: VJET (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Justin Early CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-20 20:36 EST by Justin Early CLA
Modified: 2017-04-11 15:12 EDT (History)
0 users

See Also:


Attachments
mylyn/context/zip (10.05 KB, application/octet-stream)
2013-03-07 19:10 EST, Justin Early CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Early CLA 2013-02-20 20:36:09 EST
var m = [2000,4000];

 var count = m[2] ? parseInt(m[2], 10) : 1;
     
 --count; // get warning that count must be a number

count has been inferred as a variant type of Number | int . These types int, long,float, Number or js.Number should be recognized as a Number type

Work around is to use vjet doc cast

 var count = m[2] ? parseInt(m[2], 10) : 1; //<<Number

then warning will go away
Comment 1 Justin Early CLA 2013-03-07 18:28:29 EST
Needs to check JstVariant type here to see if all variants are Number or inherits from Number such as int/long/float.
Comment 2 Justin Early CLA 2013-03-07 18:54:34 EST
had to unwrap JstInferredType in type check
Comment 3 Justin Early CLA 2013-03-07 19:10:49 EST
see previous comment
Comment 4 Justin Early CLA 2013-03-07 19:10:51 EST
Created attachment 228118 [details]
mylyn/context/zip