This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234453 - Navigator indicates wrong type of returned variable
Summary: Navigator indicates wrong type of returned variable
Status: REOPENED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-15 13:52 UTC by Vladimir Riha
Modified: 2016-07-19 14:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample project (3.12 KB, application/zip)
2013-08-16 06:48 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-08-15 13:52:31 UTC
Please try this in JS file:


/**
 * 
 * @returns {Runner}
 */
function test() {
    var b = new Runner();
    return b;
}

var a = test();


function Runner(object, name, dispose) {
    this.name = name;
    this.notify = function() {
    };
}


=> Navigator shows that test() returns either Runner or windows.test.b and the same goes for type of "a" variable



Product Version: NetBeans IDE Dev (Build 201308150051)
Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b39
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Petr Pisl 2013-08-15 15:53:08 UTC
Vlado I see in navigator that the test() function and a variable is the type Runner. I have created test for it: http://hg.netbeans.org/web-main/rev/2bf263ca0dc8 and the structure file is: http://hg.netbeans.org/web-main/file/2bf263ca0dc8/javascript2.editor/test/unit/data/testfiles/structure/issue234453.js.structure
Comment 2 Petr Pisl 2013-08-15 15:54:47 UTC
If you see something different, let me know.
Comment 3 Quality Engineering 2013-08-16 02:40:54 UTC
Integrated into 'main-silver', will be available in build *201308152300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2bf263ca0dc8
User: Petr Pisl <ppisl@netbeans.org>
Log: #234453 - Navigator indicates wrong type of returned variable
Comment 4 Vladimir Riha 2013-08-16 06:48:01 UTC
I'm sorry, it depends on having some JS library in project (I'll attach the project to reproduce it). The library also defines global function test() without return value. But please notice that in file newjavascript.js, type of variable v is either Runner or windows.test.c (so both of this types comes from test() in newjavascript.js file, not from the one in folder qunit). So the type of variable v should be Runner|undefined ?
Comment 5 Vladimir Riha 2013-08-16 06:48:28 UTC
Created attachment 138774 [details]
sample project
Comment 6 Petr Pisl 2015-05-22 08:42:03 UTC
I see the problem is that there is defined in project windows.test object.
Comment 7 Petr Hejl 2016-07-19 14:41:52 UTC
Still reproducible.