Skip to content

Commit 7074c0c

Browse files
authored
Fixed getContextuallyTypedParameterType for IIFEs without arguments (microsoft#715)
1 parent 10a1992 commit 7074c0c

File tree

53 files changed

+76
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+76
-689
lines changed

internal/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27110,7 +27110,7 @@ func (c *Checker) getContextuallyTypedParameterType(parameter *ast.Node) *Type {
2711027110
return nil
2711127111
}
2711227112
iife := ast.GetImmediatelyInvokedFunctionExpression(fn)
27113-
if iife != nil && len(iife.Arguments()) != 0 {
27113+
if iife != nil {
2711427114
args := c.getEffectiveCallArguments(iife)
2711527115
indexOfParameter := slices.Index(fn.Parameters(), parameter)
2711627116
if hasDotDotDotToken(parameter) {

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=es2015).errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=es2015).errors.txt.diff

Lines changed: 0 additions & 13 deletions
This file was deleted.

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=es5).errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=es5).errors.txt.diff

Lines changed: 0 additions & 13 deletions
This file was deleted.

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=esnext).errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern(target=esnext).errors.txt.diff

Lines changed: 0 additions & 13 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
classWithStaticFieldInParameterBindingPattern.2.ts(3,6): error TS2537: Type '{}' has no matching index signature for type 'number'.
21
classWithStaticFieldInParameterBindingPattern.2.ts(3,20): error TS2373: Parameter '{ [class extends C { static x = 1 }.x]: b = "" }' cannot reference identifier 'C' declared after it.
3-
classWithStaticFieldInParameterBindingPattern.2.ts(6,6): error TS2537: Type '{}' has no matching index signature for type 'number'.
42
classWithStaticFieldInParameterBindingPattern.2.ts(6,57): error TS2373: Parameter 'd' cannot reference identifier 'x' declared after it.
53

64

7-
==== classWithStaticFieldInParameterBindingPattern.2.ts (4 errors) ====
5+
==== classWithStaticFieldInParameterBindingPattern.2.ts (2 errors) ====
86
// https://github.com/microsoft/TypeScript/issues/36295
97
class C {}
108
(({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })();
11-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12-
!!! error TS2537: Type '{}' has no matching index signature for type 'number'.
139
~
1410
!!! error TS2373: Parameter '{ [class extends C { static x = 1 }.x]: b = "" }' cannot reference identifier 'C' declared after it.
1511

1612
const x = "";
1713
(({ [class extends C { static x = 1 }.x]: b = "" }, d = x) => { var x; })();
18-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19-
!!! error TS2537: Type '{}' has no matching index signature for type 'number'.
2014
~
2115
!!! error TS2373: Parameter 'd' cannot reference identifier 'x' declared after it.
2216

testdata/baselines/reference/submodule/conformance/classWithStaticFieldInParameterBindingPattern.2(target=es2015).errors.txt.diff

Lines changed: 0 additions & 26 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
classWithStaticFieldInParameterBindingPattern.2.ts(3,6): error TS2537: Type '{}' has no matching index signature for type 'number'.
21
classWithStaticFieldInParameterBindingPattern.2.ts(3,20): error TS2373: Parameter '{ [class extends C { static x = 1 }.x]: b = "" }' cannot reference identifier 'C' declared after it.
3-
classWithStaticFieldInParameterBindingPattern.2.ts(6,6): error TS2537: Type '{}' has no matching index signature for type 'number'.
42
classWithStaticFieldInParameterBindingPattern.2.ts(6,57): error TS2373: Parameter 'd' cannot reference identifier 'x' declared after it.
53

64

7-
==== classWithStaticFieldInParameterBindingPattern.2.ts (4 errors) ====
5+
==== classWithStaticFieldInParameterBindingPattern.2.ts (2 errors) ====
86
// https://github.com/microsoft/TypeScript/issues/36295
97
class C {}
108
(({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })();
11-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12-
!!! error TS2537: Type '{}' has no matching index signature for type 'number'.
139
~
1410
!!! error TS2373: Parameter '{ [class extends C { static x = 1 }.x]: b = "" }' cannot reference identifier 'C' declared after it.
1511

1612
const x = "";
1713
(({ [class extends C { static x = 1 }.x]: b = "" }, d = x) => { var x; })();
18-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19-
!!! error TS2537: Type '{}' has no matching index signature for type 'number'.
2014
~
2115
!!! error TS2373: Parameter 'd' cannot reference identifier 'x' declared after it.
2216

0 commit comments

Comments
 (0)