google / google/closure-compiler

Module Dependency violation isn't caught: function on prototype

Open
#895 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

I have following scenario:
I have STRICT_MODULE_DEP_QNAME.level = CheckLevel.WARNING and following testCode:

``` java
public void testBadModuleDep2() {
testSame(createModuleStar(
NAMES,
"/** @constructor */ var WI = function(){}; WI.prototype.x = function(){}; a.t = new WI();",
"a.t.x();"
), STRICT_MODULE_DEP_QNAME);
}
```

And I don't see any warnings/errors.

When I remove call of function x:

``` java
public void testBadModuleDep2() {
testSame(createModuleStar(
NAMES,
"/** @constructor */ var WI = function(){}; WI.prototype.x = function(){}; a.t = new WI();",
"a.t;"
), STRICT_MODULE_DEP_QNAME);
}
```

I see as expected:
JSC_STRICT_MODULE_DEP_QNAME. cannot reference a.t because of a missing module dependency

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.