From 7b2982ae1cbcba2b05927166c7cb0aa80f1b9467 Mon Sep 17 00:00:00 2001 From: Robin Salkeld Date: Wed, 11 Sep 2024 11:00:36 -0700 Subject: [PATCH] =?UTF-8?q?You=E2=80=99re=20never=20too=20experienced=20to?= =?UTF-8?q?=20make=20dumb=20mistakes=20:P=20(#577)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/software/amazon/polymorph/CodegenCli.java | 6 ++---- .../main/java/software/amazon/polymorph/CodegenEngine.java | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java index 8b9cd0375..9f57eda40 100644 --- a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java +++ b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java @@ -145,10 +145,8 @@ public static void main(String[] args) { cliArguments.patchFilesDir.ifPresent(engineBuilder::withPatchFilesDir); final CodegenEngine engine = engineBuilder.build(); switch (cliArguments.command) { - case GENERATE: - engine.run(); - case PATCH_AFTER_TRANSPILE: - engine.patchAfterTranspiling(); + case GENERATE -> engine.run(); + case PATCH_AFTER_TRANSPILE -> engine.patchAfterTranspiling(); } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java index e064c1994..884f960f4 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java @@ -885,10 +885,6 @@ private void patchRustAfterTranspiling() { final List lines = Files.readAllLines( implementationFromDafnyPath ); - // TODO fix root cause of duplicate extra declarations - if (lines.contains("// (extra-declarations)")) { - return; - } final int firstModDeclIndex = IntStream .range(0, lines.size()) .filter(i -> lines.get(i).trim().startsWith("pub mod"))