diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index bef9818ab..38e980505 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -1028,6 +1028,23 @@ internal class AstChecker(private val program: Program, if(targetStatement!=null) { checkFunctionCall(targetStatement, functionCallStatement.args, functionCallStatement.position) checkUnusedReturnValues(functionCallStatement, targetStatement, errors) + + if(functionCallStatement.void) { + when(targetStatement) { + is BuiltinFunctionPlaceholder -> { + if(!builtinFunctionReturnType(targetStatement.name).isKnown) + errors.warn("redundant void", functionCallStatement.position) + } + is Label -> { + errors.warn("redundant void", functionCallStatement.position) + } + is Subroutine -> { + if(targetStatement.returntypes.isEmpty()) + errors.warn("redundant void", functionCallStatement.position) + } + else -> {} + } + } } val funcName = functionCallStatement.target.nameInSource diff --git a/compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt b/compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt index b9bdc78a5..22a5cc0e2 100644 --- a/compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt +++ b/compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt @@ -328,7 +328,7 @@ internal class StatementReorderer(val program: Program, assign.value as? IdentifierReference ?: assign.value, identifier ), - true, + false, assign.position ) return listOf(IAstModification.ReplaceNode(assign, strcopy, assign.parent))