Skip to content

Commit

Permalink
Merge pull request #469 from viperproject/gobra-issue-823
Browse files Browse the repository at this point in the history
Enables plugins within ViperServer
  • Loading branch information
ArquintL authored Jan 21, 2025
2 parents 8cd2a20 + 512dee3 commit a90a0ca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
12 changes: 12 additions & 0 deletions client/src/test/data/decreases.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

package decrease

// this test case checks that Gobra / GobraServer correctly invokes
// Viper plugins as verifying this file requires the termination plugin.

decreases i
func infiniteRecursion(i int) {
infiniteRecursion(i - 1)
}
15 changes: 15 additions & 0 deletions client/src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ASSERT_TRUE = "assert_true.gobra";
const ASSERT_FALSE = "assert_false.gobra";
const FAILING_POST_GOBRA = "failing_post.gobra";
const FAILING_POST_GO = "failing_post.go";
const DECREASES = "decreases.gobra";
const PKG_FILE_1 = "pkg/file1.gobra";

const URL_CONVERSION_TIMEOUT_MS = 5000; // 5s
Expand Down Expand Up @@ -230,6 +231,20 @@ suite("Extension", () => {
);
});

test("Verify program requiring Viper plugins and underline non-terminating recursive call (Gobra Issue #823)", async function() {
this.timeout(GOBRA_VERIFICATION_TIMEOUT_MS);
const document = await openAndVerifyFile(DECREASES);
const diagnostics = vscode.languages.getDiagnostics(document.uri);
assert.ok(
diagnostics.some(
(diagnostic) => (
document.getText(diagnostic.range).includes("infiniteRecursion(i - 1)")
)
),
"The non-terminating recursive call was not reported."
);
});

test("Verifying basic programs as a package fails because of differing package names", async function() {
this.timeout(GOBRA_VERIFICATION_TIMEOUT_MS);
// note: we have to consider the diagnostics of all gobra and go files because we do not want
Expand Down
2 changes: 1 addition & 1 deletion server/gobra
Submodule gobra updated 32 files
+1 −0 src/main/antlr4/GobraLexer.g4
+1 −1 src/main/antlr4/GobraParser.g4
+1,155 −1,150 src/main/java/viper/gobra/frontend/GobraLexer.java
+555 −552 src/main/java/viper/gobra/frontend/GobraParser.java
+1 −1 src/main/java/viper/gobra/frontend/GobraParserBaseVisitor.java
+1 −1 src/main/java/viper/gobra/frontend/GobraParserVisitor.java
+2 −0 src/main/scala/viper/gobra/ast/frontend/Ast.scala
+1 −0 src/main/scala/viper/gobra/ast/frontend/PrettyPrinter.scala
+2 −0 src/main/scala/viper/gobra/ast/internal/PrettyPrinter.scala
+1 −0 src/main/scala/viper/gobra/ast/internal/Program.scala
+1 −1 src/main/scala/viper/gobra/ast/internal/transform/OverflowChecksTransform.scala
+10 −9 src/main/scala/viper/gobra/backend/BackendVerifier.scala
+7 −7 src/main/scala/viper/gobra/backend/Carbon.scala
+6 −6 src/main/scala/viper/gobra/backend/Silicon.scala
+1 −0 src/main/scala/viper/gobra/frontend/Desugar.scala
+1 −0 src/main/scala/viper/gobra/frontend/ParseTreeTranslator.scala
+1 −1 src/main/scala/viper/gobra/frontend/info/implementation/typing/StmtTyping.scala
+1 −0 src/main/scala/viper/gobra/frontend/info/implementation/typing/ghost/GhostStmtTyping.scala
+23 −14 src/main/scala/viper/gobra/reporting/DefaultErrorBackTranslator.scala
+15 −1 src/main/scala/viper/gobra/reporting/VerifierError.scala
+2 −2 src/main/scala/viper/gobra/translator/Translator.scala
+4 −4 src/main/scala/viper/gobra/translator/encodings/closures/ClosureEncoding.scala
+4 −4 src/main/scala/viper/gobra/translator/encodings/closures/ClosureSpecsEncoder.scala
+2 −2 src/main/scala/viper/gobra/translator/encodings/closures/MethodObjectEncoder.scala
+2 −0 src/main/scala/viper/gobra/translator/encodings/typeless/AssertionEncoding.scala
+6 −29 src/main/scala/viper/gobra/translator/transformers/TerminationDomainTransformer.scala
+1 −1 src/main/scala/viper/gobra/util/ChopperUtil.scala
+63 −0 src/main/scala/viper/gobra/util/PluginAwareChopper.scala
+24 −0 src/test/resources/regressions/features/refute/refute-fail-01.gobra
+40 −0 src/test/resources/regressions/features/refute/refute-fail-02.gobra
+50 −0 src/test/resources/regressions/features/refute/refute-simple-01.gobra
+42 −0 src/test/scala/viper/gobra/PluginAwareChopperTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GobraServerService(config: ServerConfig)(implicit executor: GobraServerExe
// always send full text document for each notification:
capabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental)

val options: List[String] = List("--disablePlugins", "--logLevel", config.logLevel.levelStr)
val options: List[String] = List("--logLevel", config.logLevel.levelStr)
GobraServer.init(options)(executor)
GobraServer.start()

Expand Down

0 comments on commit a90a0ca

Please sign in to comment.