forked from dafny-lang/dafny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Include arguments to Go external constructor (dafny-lang#5813)
### Description The Go backend was not passing arguments when invoking an `{:extern}` constructor. ### How has this been tested? Enabled Go in the existing `ExternCtors.dfy` test case, and refactored it to not require support for classes with both Dafny- and extern-implemented declarations (which is a separate feature). <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small> Co-authored-by: Remy Willems <rwillems@amazon.com>
- Loading branch information
1 parent
cb5666e
commit 37d3ff7
Showing
6 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/ExternCtors.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
// RUN: %run --target cs "%s" --input %S/ExternCtors-externs/Library.cs > "%t" | ||
// RUN: %run --target java "%s" --input %S/ExternCtors-externs/Class.java >> "%t" | ||
// RUN: %run --target py "%s" --input %S/ExternCtors-externs/Library.py >> "%t" | ||
// RUN: %run --target go "%s" --input %S/ExternCtors-externs/Library.go >> "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
// FIXME: Extern constructors are currently broken in Go and JavaScript, | ||
// so they are omitted | ||
// FIXME: Extern constructors are currently broken in JavaScript, | ||
// so that is omitted | ||
|
||
method Main() { | ||
Library.Class.SayHi(); | ||
var obj := new Library.Class(42); | ||
obj.Print(); | ||
print "My value is ", obj.Get(), "\n"; | ||
} | ||
|
||
module {:extern "Library"} Library { | ||
class {:extern} Class { | ||
constructor {:extern} (n: int) | ||
static method {:extern} SayHi() | ||
function {:extern} Get() : int | ||
method Print() { | ||
print "My value is ", Get(), "\n"; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters