mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 15:19:40 -05:00
fix(check): line-break between diagnostic message chain entries (#27543)
This commit is contained in:
parent
e9af7f8ebd
commit
18b813b93f
4 changed files with 25 additions and 1 deletions
|
@ -90,9 +90,9 @@ impl DiagnosticMessageChain {
|
||||||
s.push_str(&" ".repeat(level * 2));
|
s.push_str(&" ".repeat(level * 2));
|
||||||
s.push_str(&self.message_text);
|
s.push_str(&self.message_text);
|
||||||
if let Some(next) = &self.next {
|
if let Some(next) = &self.next {
|
||||||
s.push('\n');
|
|
||||||
let arr = next.clone();
|
let arr = next.clone();
|
||||||
for dm in arr {
|
for dm in arr {
|
||||||
|
s.push('\n');
|
||||||
s.push_str(&dm.format_message(level + 1));
|
s.push_str(&dm.format_message(level + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Regression test for https://github.com/denoland/deno/issues/27411.
|
||||||
|
{
|
||||||
|
"args": "check --quiet message_chain_formatting.ts",
|
||||||
|
"output": "message_chain_formatting.out",
|
||||||
|
"exitCode": 1
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
error: TS2769 [ERROR]: No overload matches this call.
|
||||||
|
Overload 1 of 3, '(s: string, b: boolean): void', gave the following error.
|
||||||
|
Argument of type 'number' is not assignable to parameter of type 'boolean'.
|
||||||
|
Overload 2 of 3, '(ss: string[], b: boolean): void', gave the following error.
|
||||||
|
Argument of type 'string' is not assignable to parameter of type 'string[]'.
|
||||||
|
Overload 3 of 3, '(ss: string[], b: Date): void', gave the following error.
|
||||||
|
Argument of type 'string' is not assignable to parameter of type 'string[]'.
|
||||||
|
foo("hello", 42);
|
||||||
|
~~~
|
||||||
|
at [WILDLINE]/message_chain_formatting.ts:8:1
|
|
@ -0,0 +1,8 @@
|
||||||
|
function foo(s: string, b: boolean): void;
|
||||||
|
function foo(ss: string[], b: boolean): void;
|
||||||
|
function foo(ss: string[], b: Date): void;
|
||||||
|
function foo(sOrSs: string | string[], b: boolean | Date): void {
|
||||||
|
console.log(sOrSs, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
foo("hello", 42);
|
Loading…
Reference in a new issue