mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Consistently resolve to the errorType on arguments with error (#62549)
This commit is contained in:
@@ -30975,7 +30975,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
||||
|
||||
if (symbol === argumentsSymbol) {
|
||||
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
||||
if (isInPropertyInitializerOrClassStaticBlock(node, /*ignoreArrowFunctions*/ true)) {
|
||||
return errorType;
|
||||
}
|
||||
return getTypeOfSymbol(symbol);
|
||||
|
||||
+32
-32
@@ -116,12 +116,12 @@ function D() {
|
||||
> : ^^^^^^^^
|
||||
|
||||
a = () => arguments // should error
|
||||
>a : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>() => arguments : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>arguments : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>a : () => any
|
||||
> : ^^^^^^^^^
|
||||
>() => arguments : () => any
|
||||
> : ^^^^^^^^^
|
||||
>arguments : any
|
||||
> : ^^^
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,18 +142,18 @@ function D1() {
|
||||
> : ^^^^^^^^^^
|
||||
|
||||
arguments; // should error
|
||||
>arguments : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>arguments : any
|
||||
> : ^^^
|
||||
|
||||
const b = () => {
|
||||
>b : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>() => { return arguments; // should error } : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>b : () => any
|
||||
> : ^^^^^^^^^
|
||||
>() => { return arguments; // should error } : () => any
|
||||
> : ^^^^^^^^^
|
||||
|
||||
return arguments; // should error
|
||||
>arguments : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>arguments : any
|
||||
> : ^^^
|
||||
}
|
||||
|
||||
function f() {
|
||||
@@ -286,16 +286,16 @@ function D5() {
|
||||
> : ^^^^^^^^
|
||||
|
||||
a = (() => { return arguments; })() // should error
|
||||
>a : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>(() => { return arguments; })() : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>(() => { return arguments; }) : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>() => { return arguments; } : () => IArguments
|
||||
> : ^^^^^^^^^^^^^^^^
|
||||
>arguments : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>a : any
|
||||
> : ^^^
|
||||
>(() => { return arguments; })() : any
|
||||
> : ^^^
|
||||
>(() => { return arguments; }) : () => any
|
||||
> : ^^^^^^^^^
|
||||
>() => { return arguments; } : () => any
|
||||
> : ^^^^^^^^^
|
||||
>arguments : any
|
||||
> : ^^^
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,14 +310,14 @@ function D6() {
|
||||
> : ^^^^^^^^
|
||||
|
||||
a = (x = arguments) => {} // should error
|
||||
>a : (x?: IArguments) => void
|
||||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^
|
||||
>(x = arguments) => {} : (x?: IArguments) => void
|
||||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^
|
||||
>x : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>arguments : IArguments
|
||||
> : ^^^^^^^^^^
|
||||
>a : (x?: any) => void
|
||||
> : ^ ^^^^^^^^^^^^^^^
|
||||
>(x = arguments) => {} : (x?: any) => void
|
||||
> : ^ ^^^^^^^^^^^^^^^
|
||||
>x : any
|
||||
> : ^^^
|
||||
>arguments : any
|
||||
> : ^^^
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user