Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[⚙️ compiler] Fix a few additional instances of %L used instead of %N #6117

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal fun readFromResponseCodeBlock(
}
.add(
CodeBlock.of(
"%L·=·%L.$fromJson($reader, $customScalarAdapters)\n",
"%N·=·%L.$fromJson($reader, $customScalarAdapters)\n",
property.info.responseName.variableName(),
Comment on lines -146 to 147
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really needed because we esacape with a '_' but feels more correct nonetheless

context.resolver.resolveModelAdapter(property.info.type.modelPath()),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal fun TypeSpec.Builder.withCopyImplementation(className: ClassName): Type
.add("return %T(", className)
.apply {
constructorProperties.forEach {
add("%L,", it.name)
add("%N,", it.name)
}
}
.add(")")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ internal fun NamedType.toSetterFunSpec(context: KotlinContext): FunSpec {
val body = CodeBlock.builder()
val parameterType: IrType
if (type.optional) {
body.add("this.%L·=·%T(%L)\n", propertyName, KotlinSymbols.Present, propertyName)
body.add("this.%N·=·%T(%N)\n", propertyName, KotlinSymbols.Present, propertyName)
parameterType = type.optional(false)
} else {
body.add("this.%L·=·%L\n", propertyName, propertyName)
body.add("this.%N·=·%N\n", propertyName, propertyName)
parameterType = type
}
body.add("return this")
Expand Down Expand Up @@ -129,7 +129,7 @@ private fun List<NamedType>.toBuildFunSpec(context: KotlinContext, returnedClass
.apply {
forEach {
val propertyName = context.layout.propertyName(it.graphQlName)
add("%L·=·%L", propertyName, propertyName)
add("%N·=·%N", propertyName, propertyName)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are for data builders

if (!it.type.nullable && !it.type.optional) {
add("·?:·error(\"missing·value·for·$propertyName\")")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal fun TypeSpec.patchKotlinNativeOptionalArrayProperties(): TypeSpec {
FunSpec
.builder("${propertySpec.name}FilterNotNull")
.returns(nonOptionalListType)
.addStatement("return·%L%L.filterNotNull()", propertySpec.name, if (propertySpec.type.isNullable) "?" else "")
.addStatement("return·%N%L.filterNotNull()", propertySpec.name, if (propertySpec.type.isNullable) "?" else "")
.build()
}
return toBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal class CompiledSelectionsBuilder(
private fun IrArgument.codeBlock(): CodeBlock {
val argumentBuilder = CodeBlock.builder()
argumentBuilder.add(
"%T(%T.%L)",
"%T(%T.%N)",
KotlinSymbols.CompiledArgument,
context.resolver.resolveArgumentDefinition(definitionId),
definitionPropertyName,
Comment on lines -128 to 131
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, not really needed because there is already __ in front of definitionPropertyName but still feels more correct

Expand Down
Loading