Skip to content

Commit 1bf3120

Browse files
authored
fix: Defuse flow assertion on invalid function expression (#2051)
1 parent b1a5b0f commit 1bf3120

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/flow.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,6 @@ export class Flow {
11931193
canOverflow(expr: ExpressionRef, type: Type): bool {
11941194
// TODO: the following catches most common and a few uncommon cases, but there are additional
11951195
// opportunities here, obviously.
1196-
assert(type != Type.void);
11971196

11981197
// types other than i8, u8, i16, u16 and bool do not overflow
11991198
if (!type.isShortIntegerValue) return false;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"asc_flags": [
3+
],
4+
"stderr": [
5+
"TS1110: Type expected.", "missingReturnType",
6+
"EOF"
7+
]
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// see: https://github.com/AssemblyScript/assemblyscript/issues/2036
2+
3+
const missingReturnType: u32 = (() => 42).index;
4+
5+
ERROR("EOF");

0 commit comments

Comments
 (0)