-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52717ac
commit f6c6b4d
Showing
10 changed files
with
224 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/baselines/reference/arrowFunctionReturnTypeErrorSpan.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
arrowFunctionReturnTypeErrorSpan.ts(2,7): error TS2451: Cannot redeclare block-scoped variable 'a'. | ||
arrowFunctionReturnTypeErrorSpan.ts(3,3): error TS2322: Type 'string' is not assignable to type 'number'. | ||
arrowFunctionReturnTypeErrorSpan.ts(6,7): error TS2451: Cannot redeclare block-scoped variable 'a'. | ||
arrowFunctionReturnTypeErrorSpan.ts(7,10): error TS2304: Cannot find name 'missing'. | ||
arrowFunctionReturnTypeErrorSpan.ts(11,25): error TS2322: Type 'string' is not assignable to type 'number'. | ||
arrowFunctionReturnTypeErrorSpan.ts(14,28): error TS2322: Type 'string' is not assignable to type 'number'. | ||
arrowFunctionReturnTypeErrorSpan.ts(16,25): error TS2304: Cannot find name 'missing'. | ||
|
||
|
||
==== arrowFunctionReturnTypeErrorSpan.ts (7 errors) ==== | ||
// block body | ||
const a = (): number => { | ||
~ | ||
!!! error TS2451: Cannot redeclare block-scoped variable 'a'. | ||
return "foo"; | ||
~~~~~~ | ||
!!! error TS2322: Type 'string' is not assignable to type 'number'. | ||
}; | ||
|
||
const a = (): number => { | ||
~ | ||
!!! error TS2451: Cannot redeclare block-scoped variable 'a'. | ||
return missing; | ||
~~~~~~~ | ||
!!! error TS2304: Cannot find name 'missing'. | ||
}; | ||
|
||
// expression body | ||
const b = (): number => "foo"; | ||
~~~~~ | ||
!!! error TS2322: Type 'string' is not assignable to type 'number'. | ||
|
||
type F<T> = T; | ||
const c = (): F<number> => "foo"; | ||
~~~~~ | ||
!!! error TS2322: Type 'string' is not assignable to type 'number'. | ||
|
||
const d = (): number => missing; | ||
~~~~~~~ | ||
!!! error TS2304: Cannot find name 'missing'. | ||
|
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/arrowFunctionReturnTypeErrorSpan.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//// [tests/cases/compiler/arrowFunctionReturnTypeErrorSpan.ts] //// | ||
|
||
//// [arrowFunctionReturnTypeErrorSpan.ts] | ||
// block body | ||
const a = (): number => { | ||
return "foo"; | ||
}; | ||
|
||
const a = (): number => { | ||
return missing; | ||
}; | ||
|
||
// expression body | ||
const b = (): number => "foo"; | ||
|
||
type F<T> = T; | ||
const c = (): F<number> => "foo"; | ||
|
||
const d = (): number => missing; | ||
|
||
|
||
//// [arrowFunctionReturnTypeErrorSpan.js] | ||
// block body | ||
var a = function () { | ||
return "foo"; | ||
}; | ||
var a = function () { | ||
return missing; | ||
}; | ||
// expression body | ||
var b = function () { return "foo"; }; | ||
var c = function () { return "foo"; }; | ||
var d = function () { return missing; }; |
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/arrowFunctionReturnTypeErrorSpan.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//// [tests/cases/compiler/arrowFunctionReturnTypeErrorSpan.ts] //// | ||
|
||
=== arrowFunctionReturnTypeErrorSpan.ts === | ||
// block body | ||
const a = (): number => { | ||
>a : Symbol(a, Decl(arrowFunctionReturnTypeErrorSpan.ts, 1, 5)) | ||
|
||
return "foo"; | ||
}; | ||
|
||
const a = (): number => { | ||
>a : Symbol(a, Decl(arrowFunctionReturnTypeErrorSpan.ts, 5, 5)) | ||
|
||
return missing; | ||
}; | ||
|
||
// expression body | ||
const b = (): number => "foo"; | ||
>b : Symbol(b, Decl(arrowFunctionReturnTypeErrorSpan.ts, 10, 5)) | ||
|
||
type F<T> = T; | ||
>F : Symbol(F, Decl(arrowFunctionReturnTypeErrorSpan.ts, 10, 30)) | ||
>T : Symbol(T, Decl(arrowFunctionReturnTypeErrorSpan.ts, 12, 7)) | ||
>T : Symbol(T, Decl(arrowFunctionReturnTypeErrorSpan.ts, 12, 7)) | ||
|
||
const c = (): F<number> => "foo"; | ||
>c : Symbol(c, Decl(arrowFunctionReturnTypeErrorSpan.ts, 13, 5)) | ||
>F : Symbol(F, Decl(arrowFunctionReturnTypeErrorSpan.ts, 10, 30)) | ||
|
||
const d = (): number => missing; | ||
>d : Symbol(d, Decl(arrowFunctionReturnTypeErrorSpan.ts, 15, 5)) | ||
|
57 changes: 57 additions & 0 deletions
57
tests/baselines/reference/arrowFunctionReturnTypeErrorSpan.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//// [tests/cases/compiler/arrowFunctionReturnTypeErrorSpan.ts] //// | ||
|
||
=== arrowFunctionReturnTypeErrorSpan.ts === | ||
// block body | ||
const a = (): number => { | ||
>a : () => number | ||
> : ^^^^^^ | ||
>(): number => { return "foo";} : () => number | ||
> : ^^^^^^ | ||
|
||
return "foo"; | ||
>"foo" : "foo" | ||
> : ^^^^^ | ||
|
||
}; | ||
|
||
const a = (): number => { | ||
>a : () => number | ||
> : ^^^^^^ | ||
>(): number => { return missing;} : () => number | ||
> : ^^^^^^ | ||
|
||
return missing; | ||
>missing : any | ||
> : ^^^ | ||
|
||
}; | ||
|
||
// expression body | ||
const b = (): number => "foo"; | ||
>b : () => number | ||
> : ^^^^^^ | ||
>(): number => "foo" : () => number | ||
> : ^^^^^^ | ||
>"foo" : "foo" | ||
> : ^^^^^ | ||
|
||
type F<T> = T; | ||
>F : T | ||
> : ^ | ||
|
||
const c = (): F<number> => "foo"; | ||
>c : () => F<number> | ||
> : ^^^^^^ | ||
>(): F<number> => "foo" : () => F<number> | ||
> : ^^^^^^ | ||
>"foo" : "foo" | ||
> : ^^^^^ | ||
|
||
const d = (): number => missing; | ||
>d : () => number | ||
> : ^^^^^^ | ||
>(): number => missing : () => number | ||
> : ^^^^^^ | ||
>missing : any | ||
> : ^^^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,7 @@ f( // comment 1 | |
// body is not a block | ||
f(_ => 1 + | ||
2); | ||
|
||
f((): number => { }); | ||
|
||
f((): number => ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// block body | ||
const a = (): number => { | ||
return "foo"; | ||
}; | ||
|
||
const a = (): number => { | ||
return missing; | ||
}; | ||
|
||
// expression body | ||
const b = (): number => "foo"; | ||
|
||
type F<T> = T; | ||
const c = (): F<number> => "foo"; | ||
|
||
const d = (): number => missing; |