From a5f9eb45859642ca2906fb64d1473dac53ae66a7 Mon Sep 17 00:00:00 2001 From: Duncan Uszkay Date: Mon, 23 Mar 2020 19:16:35 -0400 Subject: [PATCH 1/2] Added helpful error before trying to resolve function that is missing type parameters --- src/compiler.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/compiler.ts b/src/compiler.ts index bd1d7708af..f86988c072 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -7941,6 +7941,16 @@ export class Compiler extends DiagnosticEmitter { } case ElementKind.FUNCTION_PROTOTYPE: { let functionPrototype = target; + let typeParameterNodes = functionPrototype.typeParameterNodes; + + if(typeParameterNodes !== null && typeParameterNodes.length != 0) { + this.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + expression.range, typeParameterNodes.length.toString(), "0" + ); + return module.unreachable(); + } + let functionInstance = this.resolver.resolveFunction( functionPrototype, null, From 0e6057ed0078f570b8b1a1d7e1b204bac1758cb6 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 24 Mar 2020 11:17:07 -0400 Subject: [PATCH 2/2] Add space between if and bracket Co-Authored-By: Max Graey --- src/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler.ts b/src/compiler.ts index f86988c072..495f670822 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -7943,7 +7943,7 @@ export class Compiler extends DiagnosticEmitter { let functionPrototype = target; let typeParameterNodes = functionPrototype.typeParameterNodes; - if(typeParameterNodes !== null && typeParameterNodes.length != 0) { + if (typeParameterNodes !== null && typeParameterNodes.length != 0) { this.error( DiagnosticCode.Expected_0_arguments_but_got_1, expression.range, typeParameterNodes.length.toString(), "0"