From 84dafda0e40eef81d54408fa6b7e58d757492678 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 9 Nov 2021 22:19:07 +0100 Subject: [PATCH] fix error message for type mismatch on builtin-function parameter --- .../compiler/astprocessing/VerifyFunctionArgTypes.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/VerifyFunctionArgTypes.kt b/compiler/src/prog8/compiler/astprocessing/VerifyFunctionArgTypes.kt index 6b1c31050..46838ce87 100644 --- a/compiler/src/prog8/compiler/astprocessing/VerifyFunctionArgTypes.kt +++ b/compiler/src/prog8/compiler/astprocessing/VerifyFunctionArgTypes.kt @@ -83,8 +83,13 @@ class VerifyFunctionArgTypes(val program: Program) : IAstVisitor { val anyCompatible = pair.second.any { argTypeCompatible(pair.first, it) } if (!anyCompatible) { val actual = pair.first.toString() - val expected = pair.second.toString() - return "argument ${index + 1} type mismatch, was: $actual expected: $expected" + return if(pair.second.size==1) { + val expected = pair.second[0].toString() + "argument ${index + 1} type mismatch, was: $actual expected: $expected" + } else { + val expected = pair.second.toList().toString() + "argument ${index + 1} type mismatch, was: $actual expected one of: $expected" + } } } }