From 2639e42f7a7987c0f441c7f6000c335bfc279b7b Mon Sep 17 00:00:00 2001 From: ivanjermakov Date: Fri, 19 Apr 2024 13:29:42 +0200 Subject: [PATCH] Code cleanup --- src/lexer/lexer.ts | 2 +- src/semantic/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lexer/lexer.ts b/src/lexer/lexer.ts index 77c4373a..83302f4f 100644 --- a/src/lexer/lexer.ts +++ b/src/lexer/lexer.ts @@ -49,7 +49,7 @@ export const lexerKeywordKinds = [ 'in-keyword', 'match-keyword', 'pub-keyword', - 'await-keyword', + 'await-keyword' ] export const lexerDynamicKinds = ['name', 'string-part', 'char', 'int', 'float', 'bool'] diff --git a/src/semantic/index.ts b/src/semantic/index.ts index 3d969caa..3f4810b9 100644 --- a/src/semantic/index.ts +++ b/src/semantic/index.ts @@ -789,7 +789,7 @@ export const checkType = (type: Type, ctx: Context) => { } } -export const resolveMallebleType = (operand: Operand, inferred: VirtualType, ctx: Context): void => { +export const resolveMalleableType = (operand: Operand, inferred: VirtualType, ctx: Context): void => { if (operand.type!.kind === 'malleable-type' && inferred.kind === 'fn-type') { switch (operand.type!.operand.kind) { case 'closure-expr': @@ -799,7 +799,7 @@ export const resolveMallebleType = (operand: Operand, inferred: VirtualType, ctx case 'identifier': // TODO: properly const ref = operand.type!.operand.ref - if (ref?.def.kind !== 'method-def') return unreachable() + assert(ref?.def.kind === 'method-def') operand.type = checkQualifiedMethodCall( operand.type!.operand, >ref, @@ -823,7 +823,7 @@ export const checkCallArgs = (node: AstNode, args: Operand[], paramTypes: V for (let i = 0; i < paramTypes.length; i++) { const paramType = paramTypes[i] const arg = args[i] - resolveMallebleType(arg, paramType, ctx) + resolveMalleableType(arg, paramType, ctx) if (!isAssignable(arg.type!, paramType, ctx)) { addError(ctx, typeError(ctx, arg, arg.type!, paramType)) }