Skip to content

Commit e394ad8

Browse files
drganjooFahad Zubair
andauthored
Fix TSApplicationGenerator to use Result<> instead of #{Result} (#4031)
The [earlier PR](#4010), which ensured that a Smithy shape named `Result` does not conflict with the Rust type `Result`, had a bug in `TSApplicationGenerator`. The `rustTemplateBlock` was using `#{Result}` but `preludeScope` was not passed in as a parameter. This bug can be addressed in two ways: 1. Pass `*RuntimeType.preludeScope` to the `rustBlockTemplate` call 2. Remove `#{Result}` from `rustBlockTemplate` and continue using `Result<>` This PR implements the second approach because: 1. `TSApplicationGenerator` is slated for deprecation 2. The CI step `CI / PR Bot / Generate diff and upload to S3 (pull_request)` currently fails when comparing codegen between HEAD and this version. Removing `#{Result}` is the most reliable way to avoid parameter-passing issues with `rustBlockTemplate` Co-authored-by: Fahad Zubair <fahadzub@amazon.com>
1 parent bb92aef commit e394ad8

File tree

1 file changed

+1
-1
lines changed
  • codegen-server/typescript/src/main/kotlin/software/amazon/smithy/rust/codegen/server/typescript/smithy/generators

1 file changed

+1
-1
lines changed

codegen-server/typescript/src/main/kotlin/software/amazon/smithy/rust/codegen/server/typescript/smithy/generators/TsApplicationGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class TsApplicationGenerator(
212212
)
213213
}
214214
writer.rustBlockTemplate(
215-
"""pub fn new_socket(address: String, port: i32, backlog: Option<i32>) -> #{Result}<#{socket2}::Socket, Box<dyn std::error::Error>> """.trimIndent(),
215+
"""pub fn new_socket(address: String, port: i32, backlog: Option<i32>) -> Result<#{socket2}::Socket, Box<dyn std::error::Error>> """.trimIndent(),
216216
*codegenScope,
217217
) {
218218
writer.rustTemplate(

0 commit comments

Comments
 (0)