From 24655d23d6e6d9e7042493d6528c29e6eb17a066 Mon Sep 17 00:00:00 2001 From: romdotdog <70765447+romdotdog@users.noreply.github.com> Date: Sat, 26 Mar 2022 14:46:12 -0500 Subject: [PATCH 1/3] fix --- src/compiler.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler.ts b/src/compiler.ts index 1bf749ba35..d7f4ce1529 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -7756,6 +7756,13 @@ export class Compiler extends DiagnosticEmitter { uniqueMap(flow.contextualTypeArguments) ); if (!functionInstance || !this.compileFunction(functionInstance)) return module.unreachable(); + if (functionInstance.hasDecorator(DecoratorFlags.BUILTIN)) { + this.error( + DiagnosticCode.Not_implemented_0, + expression.range, "First-class built-ins" + ); + return module.unreachable(); + } if (contextualType.isExternalReference) { this.currentType = Type.funcref; return module.ref_func(functionInstance.internalName, TypeRef.Funcref); // TODO From a35b3ee8f7c29325a30cc249681ae81ad632dbdb Mon Sep 17 00:00:00 2001 From: romdotdog <70765447+romdotdog@users.noreply.github.com> Date: Sat, 26 Mar 2022 14:50:30 -0500 Subject: [PATCH 2/3] add tests --- tests/compiler/issues/2202.json | 24 ++++++++++++++++++++++++ tests/compiler/issues/2202.ts | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tests/compiler/issues/2202.json create mode 100644 tests/compiler/issues/2202.ts diff --git a/tests/compiler/issues/2202.json b/tests/compiler/issues/2202.json new file mode 100644 index 0000000000..5f2e3488a6 --- /dev/null +++ b/tests/compiler/issues/2202.json @@ -0,0 +1,24 @@ +{ + "asc_flags": [ + ], + "stderr": [ + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "AS100: Not implemented: First-class built-ins", + "EOF" + ] +} diff --git a/tests/compiler/issues/2202.ts b/tests/compiler/issues/2202.ts new file mode 100644 index 0000000000..52d3a313b8 --- /dev/null +++ b/tests/compiler/issues/2202.ts @@ -0,0 +1,18 @@ +i16; +i32; +i64; +u8; +u16; +u32; +u64; +bool; +f32; +f64; +v128; +i8x16; +i16x8; +i32x4; +i64x2; +f32x4; +f64x2; +ERROR("EOF"); \ No newline at end of file From b43c7aabc43ef2c1e185954e35f8cded96260ff3 Mon Sep 17 00:00:00 2001 From: romdotdog <70765447+romdotdog@users.noreply.github.com> Date: Sun, 27 Mar 2022 17:23:22 -0500 Subject: [PATCH 3/3] set `this.currentType` to `functionInstance` --- src/compiler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler.ts b/src/compiler.ts index d7f4ce1529..d0c3bfa88e 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -7761,6 +7761,7 @@ export class Compiler extends DiagnosticEmitter { DiagnosticCode.Not_implemented_0, expression.range, "First-class built-ins" ); + this.currentType = functionInstance.type; return module.unreachable(); } if (contextualType.isExternalReference) {