From 3049d3cd027a07aa395fd1e0afe4cb9cb4009347 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 17 Oct 2023 15:22:24 +0800 Subject: [PATCH] fix: use correct valueType for compileAssignment[NFC] In `makeAssignment`, `valueType` doesn't match witch valueExpr. But there are no actual influence for current generated wasm. --- src/compiler.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index cda945784b..3d56841b1c 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -5703,10 +5703,12 @@ export class Compiler extends DiagnosticEmitter { assert(targetType != Type.void); let valueExpr = this.compileExpression(valueExpression, targetType); let valueType = this.currentType; + if (targetType.isNullableReference && this.currentFlow.isNonnull(valueExpr, valueType)) targetType = targetType.nonNullableType; + valueExpr = this.convertExpression(valueExpr, valueType, targetType, false, valueExpression); return this.makeAssignment( target, - this.convertExpression(valueExpr, valueType, targetType, false, valueExpression), - valueType, + valueExpr, + targetType, valueExpression, thisExpression, elementExpression,