From cb102a24fd537948f34ab297bb52eaa5c961c327 Mon Sep 17 00:00:00 2001 From: Dmitry Morozovsky <27895587+icemachined@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:24:56 +0300 Subject: [PATCH] False positive WRONG_OVERLOADING_FUNCTION_ARGUMENTS (#1623) ### What's done: test case closes #1594 --- .../OverloadingArgumentsFunctionWarnTest.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt index eac4209fa8..3e89a305d7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt @@ -61,6 +61,36 @@ class OverloadingArgumentsFunctionWarnTest : LintTestBase(::OverloadingArguments ) } + @Test + @Tag(WarningNames.WRONG_OVERLOADING_FUNCTION_ARGUMENTS) + fun `functions with override modifiers`() { + lintMethod( + """ + |fun list(projectCoordinates: ProjectCoordinates): Flux = list() + | .filter { it.projectCoordinates == projectCoordinates } + | + |override fun list(): Flux = newFileStorage.list() + | .map { fileDto -> + | FileKey( + | projectCoordinates = fileDto.projectCoordinates, + | name = fileDto.name, + | uploadedMillis = fileDto.uploadedTime.toInstant(TimeZone.UTC).toEpochMilliseconds() + | ) + | } + """.trimMargin(), + ) + } + @Test + @Tag(WarningNames.WRONG_OVERLOADING_FUNCTION_ARGUMENTS) + fun `functions with override modifiers simple`() { + lintMethod( + """ + |fun foo(a: Int) {} + |override fun foo() {} + """.trimMargin() + ) + } + @Test @Tag(WarningNames.WRONG_OVERLOADING_FUNCTION_ARGUMENTS) fun `functions with unordered, but same modifiers`() {