Skip to content

Commit 9c0db25

Browse files
authored
fix: Add unimplemented error for first-class built-ins (#2240)
1 parent 89035f5 commit 9c0db25

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

src/compiler.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7756,6 +7756,14 @@ export class Compiler extends DiagnosticEmitter {
77567756
uniqueMap<string,Type>(flow.contextualTypeArguments)
77577757
);
77587758
if (!functionInstance || !this.compileFunction(functionInstance)) return module.unreachable();
7759+
if (functionInstance.hasDecorator(DecoratorFlags.BUILTIN)) {
7760+
this.error(
7761+
DiagnosticCode.Not_implemented_0,
7762+
expression.range, "First-class built-ins"
7763+
);
7764+
this.currentType = functionInstance.type;
7765+
return module.unreachable();
7766+
}
77597767
if (contextualType.isExternalReference) {
77607768
this.currentType = Type.funcref;
77617769
return module.ref_func(functionInstance.internalName, TypeRef.Funcref); // TODO

tests/compiler/issues/2202.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"asc_flags": [
3+
],
4+
"stderr": [
5+
"AS100: Not implemented: First-class built-ins",
6+
"AS100: Not implemented: First-class built-ins",
7+
"AS100: Not implemented: First-class built-ins",
8+
"AS100: Not implemented: First-class built-ins",
9+
"AS100: Not implemented: First-class built-ins",
10+
"AS100: Not implemented: First-class built-ins",
11+
"AS100: Not implemented: First-class built-ins",
12+
"AS100: Not implemented: First-class built-ins",
13+
"AS100: Not implemented: First-class built-ins",
14+
"AS100: Not implemented: First-class built-ins",
15+
"AS100: Not implemented: First-class built-ins",
16+
"AS100: Not implemented: First-class built-ins",
17+
"AS100: Not implemented: First-class built-ins",
18+
"AS100: Not implemented: First-class built-ins",
19+
"AS100: Not implemented: First-class built-ins",
20+
"AS100: Not implemented: First-class built-ins",
21+
"AS100: Not implemented: First-class built-ins",
22+
"EOF"
23+
]
24+
}

tests/compiler/issues/2202.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
i16;
2+
i32;
3+
i64;
4+
u8;
5+
u16;
6+
u32;
7+
u64;
8+
bool;
9+
f32;
10+
f64;
11+
v128;
12+
i8x16;
13+
i16x8;
14+
i32x4;
15+
i64x2;
16+
f32x4;
17+
f64x2;
18+
ERROR("EOF");

0 commit comments

Comments
 (0)