Skip to content

Commit 0442f87

Browse files
authored
Fix translation error in binding of binary expressions (#1768)
1 parent 9f6a04c commit 0442f87

File tree

3 files changed

+7
-37
lines changed

3 files changed

+7
-37
lines changed

internal/binder/binder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,12 +2243,12 @@ func (b *Binder) bindBinaryExpressionFlow(node *ast.Node) {
22432243
b.bind(expr.Left)
22442244
b.bind(expr.Type)
22452245
if operator == ast.KindCommaToken {
2246-
b.maybeBindExpressionFlowIfCall(node)
2246+
b.maybeBindExpressionFlowIfCall(expr.Left)
22472247
}
22482248
b.bind(expr.OperatorToken)
22492249
b.bind(expr.Right)
22502250
if operator == ast.KindCommaToken {
2251-
b.maybeBindExpressionFlowIfCall(node)
2251+
b.maybeBindExpressionFlowIfCall(expr.Right)
22522252
}
22532253
if ast.IsAssignmentOperator(operator) && !ast.IsAssignmentTarget(node) {
22542254
b.bindAssignmentTargetFlow(expr.Left)

testdata/baselines/reference/submodule/compiler/controlFlowCommaExpressionAssertionMultiple.types

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ function func(foo: any, bar: any) {
2020
>bar : any
2121

2222
foo;
23-
>foo : any
23+
>foo : number
2424

2525
bar;
26-
>bar : any
26+
>bar : string
2727
}
2828

2929
function func2(foo: any, bar: any, baz: any) {
@@ -46,12 +46,12 @@ function func2(foo: any, bar: any, baz: any) {
4646
>baz : any
4747

4848
foo;
49-
>foo : any
49+
>foo : number
5050

5151
bar;
52-
>bar : any
52+
>bar : string
5353

5454
baz;
55-
>baz : any
55+
>baz : boolean
5656
}
5757

testdata/baselines/reference/submodule/compiler/controlFlowCommaExpressionAssertionMultiple.types.diff

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

0 commit comments

Comments
 (0)