Skip to content

Commit 1c806f5

Browse files
authored
fix: Defuse assert when flattening after diagnosed error (#2233)
1 parent b571122 commit 1c806f5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/module.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,10 @@ export class Module {
14521452
}
14531453
}
14541454
let singleType = getExpressionType(single);
1455-
assert(singleType == TypeRef.Unreachable || singleType == type);
1455+
if (singleType != TypeRef.Unreachable && singleType != type) {
1456+
// can happen when there was a diagnostic prior
1457+
return this.unreachable();
1458+
}
14561459
return single;
14571460
}
14581461
return this.block(null, stmts, type);

0 commit comments

Comments
 (0)