From 8602ede8b0ad92f6db68d6cc3d87a70b6e807f04 Mon Sep 17 00:00:00 2001 From: Kevin Wooten Date: Fri, 15 Dec 2023 05:21:11 -0700 Subject: [PATCH] Fix name shaowing warnings --- src/main/java/io/outfoxx/swiftpoet/CodeWriter.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/outfoxx/swiftpoet/CodeWriter.kt b/src/main/java/io/outfoxx/swiftpoet/CodeWriter.kt index df703507..98652098 100644 --- a/src/main/java/io/outfoxx/swiftpoet/CodeWriter.kt +++ b/src/main/java/io/outfoxx/swiftpoet/CodeWriter.kt @@ -205,8 +205,7 @@ internal class CodeWriter constructor( var a = 0 val partIterator = codeBlock.formatParts.listIterator() while (partIterator.hasNext()) { - val part = partIterator.next() - when (part) { + when (val part = partIterator.next()) { "%L" -> emitLiteral(codeBlock.args[a++], isConstantContext) "%N" -> emit(codeBlock.args[a++] as String) @@ -452,7 +451,7 @@ internal class CodeWriter constructor( importsCollector.suggestedImports() .generateImports( generatedImports, - canonicalName = DeclaredTypeName::canonicalName, + DeclaredTypeName::canonicalName, ) } @@ -465,11 +464,11 @@ internal class CodeWriter constructor( private fun Map.generateImports( generatedImports: MutableMap, - canonicalName: T.() -> String, + canonicalNameAccessor: T.() -> String, ): Map { return flatMap { (simpleName, qualifiedName) -> listOf(simpleName to qualifiedName).also { - val canonicalName = qualifiedName.canonicalName() + val canonicalName = qualifiedName.canonicalNameAccessor() generatedImports[canonicalName] = canonicalName } }.toMap()