From 66a0eb5103aa6bdb56194dd775994f0f5bebe5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Wed, 7 Apr 2021 10:35:42 -0400 Subject: [PATCH] fix: Fix usage of namespaced classes This patch reports a diagnostic when using a class (or any other construct) that lacks a runtime representation as an expression --- src/compiler.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 786f3619f0..6b20136dfc 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -9049,8 +9049,11 @@ export class Compiler extends DiagnosticEmitter { : module.i32(i64_low(offset)); } } - assert(false); - return module.unreachable(); + this.error( + DiagnosticCode.Expression_refers_to_a_static_element_that_does_not_compile_to_a_value_at_runtime, + expression.range + ); + return this.module.unreachable(); } private compileTernaryExpression(