diff --git a/src/flow.ts b/src/flow.ts index 691a8e55d7..d685df7409 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -1193,7 +1193,6 @@ export class Flow { canOverflow(expr: ExpressionRef, type: Type): bool { // TODO: the following catches most common and a few uncommon cases, but there are additional // opportunities here, obviously. - assert(type != Type.void); // types other than i8, u8, i16, u16 and bool do not overflow if (!type.isShortIntegerValue) return false; diff --git a/tests/compiler/function-expression-error.json b/tests/compiler/function-expression-error.json new file mode 100644 index 0000000000..6476b63d8e --- /dev/null +++ b/tests/compiler/function-expression-error.json @@ -0,0 +1,8 @@ +{ + "asc_flags": [ + ], + "stderr": [ + "TS1110: Type expected.", "missingReturnType", + "EOF" + ] +} diff --git a/tests/compiler/function-expression-error.ts b/tests/compiler/function-expression-error.ts new file mode 100644 index 0000000000..310b903961 --- /dev/null +++ b/tests/compiler/function-expression-error.ts @@ -0,0 +1,5 @@ +// see: https://github.com/AssemblyScript/assemblyscript/issues/2036 + +const missingReturnType: u32 = (() => 42).index; + +ERROR("EOF");