Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noErrorTruncation affects semantic diagnostics #36306

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ namespace ts {
{
name: "noErrorTruncation",
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_truncate_error_messages
},
Expand Down
33 changes: 33 additions & 0 deletions src/testRunner/unittests/tscWatch/programUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,39 @@ foo().hello`
]
});

verifyTscWatch({
scenario,
subScenario: "updates errors when noErrorTruncation changes",
commandLineArgs: ["-w"],
sys: () => {
const aFile: File = {
path: `${projectRoot}/a.ts`,
content: `declare var v: {
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
};
v === 'foo';`
};
const config: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({ compilerOptions: {} })
};
return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot });
},
changes: [
sys => {
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { noErrorTruncation: true } }));
sys.runQueuedTimeoutCallbacks();
return "Enable noErrorTruncation";
},
]
});

verifyTscWatch({
scenario,
subScenario: "updates diagnostics and emit when useDefineForClassFields changes",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/a/lib/tsc.js -w
//// [/user/username/projects/myproject/a.ts]
declare var v: {
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
};
v === 'foo';

//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{}}

//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }

//// [/user/username/projects/myproject/a.js]
v === 'foo';



Output::
>> Screen clear
12:00:21 AM - Starting compilation in watch mode...


a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | ... 4 more ... | object; reallyLongPropertyName4: string | ... 4 more ... | object; reallyLongPropertyName5: string | ... 4...' and 'string' have no overlap.


12:00:24 AM - Found 1 error. Watching for file changes.


Program root files: ["/user/username/projects/myproject/a.ts"]
Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/a.ts

Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/myproject/a.ts

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
/a/lib/lib.d.ts:
{"pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined

Change:: Enable noErrorTruncation

//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{"noErrorTruncation":true}}


Output::
>> Screen clear
12:00:28 AM - File change detected. Starting incremental compilation...


a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | number | bigint | boolean | symbol | object; reallyLongPropertyName4: string | number | bigint | boolean | symbol | object; reallyLongPropertyName5: string | number | bigint | boolean | symbol | object; reallyLongPropertyName6: string | number | bigint | boolean | symbol | object; reallyLongPropertyName7: string | number | bigint | boolean | symbol | object; }' and 'string' have no overlap.


12:00:29 AM - Found 1 error. Watching for file changes.


Program root files: ["/user/username/projects/myproject/a.ts"]
Program options: {"noErrorTruncation":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/a.ts

Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/myproject/a.ts

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
/a/lib/lib.d.ts:
{"pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined