Javascript methods resolving when they should not

Hi, I have a question about the inspection "Unresolved JavaScript function".
Given the following code:

function MyClass() {}
MyClass.prototype.myFunction = function () {};


var myString = "a string";
myString.myFunction();


I would expect an error highlighted on the last line, but it resolves just fine. myFunction() does not appear on the autocomplete-list, but if I write it out, I don't get any errors (and CMD+mouseclick takes me to the definition above).

Am I missing something fundamentally, or is this the wrong behaviour? Does every function defined (in any namespace or class) resolve for any type of object? Is there a reason that it has to be this way?

Preben
1 comment

Reproduced. This is a wrong behavior. Control flow should be fixed.
Please file an issue in the http://youtrack.jetbrains.com/issues/WEB#newissue=yes

0

Please sign in to leave a comment.