diff --git a/linter-4.2/src/TypeScriptLinter.ts b/linter-4.2/src/TypeScriptLinter.ts index 27442da9f6353270955b0c54de49988c6273e5b3..dc4c76a9de092ae98b2ac09cebc883f926128640 100644 --- a/linter-4.2/src/TypeScriptLinter.ts +++ b/linter-4.2/src/TypeScriptLinter.ts @@ -1861,13 +1861,13 @@ export class TypeScriptLinter { let rangesToFilter: { begin: number, end: number }[] = []; if (nonFilteringRanges.length !== 0) { let rangesSize = nonFilteringRanges.length; - rangesToFilter.push({ begin: callExpr.pos, end: nonFilteringRanges[0].begin }) - rangesToFilter.push({ begin: nonFilteringRanges[rangesSize - 1].end, end: callExpr.end }) + rangesToFilter.push({ begin: callExpr.arguments.pos, end: nonFilteringRanges[0].begin }) + rangesToFilter.push({ begin: nonFilteringRanges[rangesSize - 1].end, end: callExpr.arguments.end }) for (let i = 0; i < rangesSize - 1; i++) { rangesToFilter.push({ begin: nonFilteringRanges[i].end, end: nonFilteringRanges[i + 1].begin }) } } else { - rangesToFilter.push({ begin: callExpr.pos, end: callExpr.end }) + rangesToFilter.push({ begin: callExpr.arguments.pos, end: callExpr.arguments.end }) } this.filterStrictDiagnostics({ diff --git a/linter-4.2/test/functions.ts b/linter-4.2/test/functions.ts index 8d67f99ff3292a00005ed662c0798ca5ab08801e..fd8646324ae5cec720ba4c189a8dfdac408f85ff 100644 --- a/linter-4.2/test/functions.ts +++ b/linter-4.2/test/functions.ts @@ -105,4 +105,23 @@ bar(() => { bar(() => { f(null); }, null, f(null)); -}, null, foo(f(null))); \ No newline at end of file +}, null, foo(f(null))); + +type PropDecorator = () => void; +let Builder: PropDecorator; + +// this test is useless until we use custom tsc +@Builder +function buildSwiper() { + f(null) + foo(null) { + f(null) + foo(null) { + f(null) + foo(() => { + f(null) + }) + } + .foo(null) + } +} diff --git a/linter-4.2/test/functions.ts.autofix.json b/linter-4.2/test/functions.ts.autofix.json index bdec3c538a0a38afa2968f452019ea0cc98ccffe..944c5bf6b00aa3659df8313054492cb1ea47856f 100644 --- a/linter-4.2/test/functions.ts.autofix.json +++ b/linter-4.2/test/functions.ts.autofix.json @@ -157,6 +157,38 @@ "autofixable": false, "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file diff --git a/linter-4.2/test/functions.ts.relax.json b/linter-4.2/test/functions.ts.relax.json index e11f7f9c4b4ba8fd83a515d2609ee21e3b7f6c08..1e86ab2f19832ca9bf8a34ad0e3cf11cea54bb8e 100644 --- a/linter-4.2/test/functions.ts.relax.json +++ b/linter-4.2/test/functions.ts.relax.json @@ -125,6 +125,34 @@ "problem": "StrictDiagnostic", "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file diff --git a/linter-4.2/test/functions.ts.strict.json b/linter-4.2/test/functions.ts.strict.json index d39199ff0024aa2f8a01d89ad214a4e3c83e8212..a1c2214e52d001dfb28b51cd6867ddd774c91cdb 100644 --- a/linter-4.2/test/functions.ts.strict.json +++ b/linter-4.2/test/functions.ts.strict.json @@ -139,6 +139,34 @@ "problem": "StrictDiagnostic", "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file diff --git a/linter/src/TypeScriptLinter.ts b/linter/src/TypeScriptLinter.ts index 15d018ed5999142bb38be27095e9792ba21f180b..caae842224f28269fa4d0e3be22c430952661f98 100644 --- a/linter/src/TypeScriptLinter.ts +++ b/linter/src/TypeScriptLinter.ts @@ -1536,13 +1536,13 @@ export class TypeScriptLinter { let rangesToFilter: { begin: number, end: number }[] = []; if (nonFilteringRanges.length !== 0) { let rangesSize = nonFilteringRanges.length; - rangesToFilter.push({ begin: callExpr.pos, end: nonFilteringRanges[0].begin }) - rangesToFilter.push({ begin: nonFilteringRanges[rangesSize - 1].end, end: callExpr.end }) + rangesToFilter.push({ begin: callExpr.arguments.pos, end: nonFilteringRanges[0].begin }) + rangesToFilter.push({ begin: nonFilteringRanges[rangesSize - 1].end, end: callExpr.arguments.end }) for (let i = 0; i < rangesSize - 1; i++) { rangesToFilter.push({ begin: nonFilteringRanges[i].end, end: nonFilteringRanges[i + 1].begin }) } } else { - rangesToFilter.push({ begin: callExpr.pos, end: callExpr.end }) + rangesToFilter.push({ begin: callExpr.arguments.pos, end: callExpr.arguments.end }) } this.filterStrictDiagnostics({ diff --git a/linter/test/functions.ts b/linter/test/functions.ts index 8d67f99ff3292a00005ed662c0798ca5ab08801e..fd8646324ae5cec720ba4c189a8dfdac408f85ff 100644 --- a/linter/test/functions.ts +++ b/linter/test/functions.ts @@ -105,4 +105,23 @@ bar(() => { bar(() => { f(null); }, null, f(null)); -}, null, foo(f(null))); \ No newline at end of file +}, null, foo(f(null))); + +type PropDecorator = () => void; +let Builder: PropDecorator; + +// this test is useless until we use custom tsc +@Builder +function buildSwiper() { + f(null) + foo(null) { + f(null) + foo(null) { + f(null) + foo(() => { + f(null) + }) + } + .foo(null) + } +} diff --git a/linter/test/functions.ts.autofix.json b/linter/test/functions.ts.autofix.json index bdec3c538a0a38afa2968f452019ea0cc98ccffe..944c5bf6b00aa3659df8313054492cb1ea47856f 100755 --- a/linter/test/functions.ts.autofix.json +++ b/linter/test/functions.ts.autofix.json @@ -157,6 +157,38 @@ "autofixable": false, "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "autofixable": false, + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file diff --git a/linter/test/functions.ts.relax.json b/linter/test/functions.ts.relax.json index e11f7f9c4b4ba8fd83a515d2609ee21e3b7f6c08..1e86ab2f19832ca9bf8a34ad0e3cf11cea54bb8e 100644 --- a/linter/test/functions.ts.relax.json +++ b/linter/test/functions.ts.relax.json @@ -125,6 +125,34 @@ "problem": "StrictDiagnostic", "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file diff --git a/linter/test/functions.ts.strict.json b/linter/test/functions.ts.strict.json index d39199ff0024aa2f8a01d89ad214a4e3c83e8212..a1c2214e52d001dfb28b51cd6867ddd774c91cdb 100644 --- a/linter/test/functions.ts.strict.json +++ b/linter/test/functions.ts.strict.json @@ -139,6 +139,34 @@ "problem": "StrictDiagnostic", "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 116, + "column": 5, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 118, + "column": 7, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 120, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." + }, + { + "line": 122, + "column": 11, + "problem": "StrictDiagnostic", + "suggest": "Argument of type 'null' is not assignable to parameter of type 'string'.", + "rule": "Argument of type 'null' is not assignable to parameter of type 'string'." } ] } \ No newline at end of file