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

fix(java): unqualified type cast in pattern dtor #2904

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Source/DafnyCore/Compilers/Compiler-java.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ string DtCtorName(DatatypeCtor ctor) {
if (dt is TupleTypeDecl tupleDecl) {
return DafnyTupleClass(tupleDecl.NonGhostDims);
}
var dtName = IdProtect(dt.CompileName);
var dtName = IdProtect(dt.FullCompileName);
return dt.IsRecordType ? dtName : dtName + "_" + ctor.CompileName;
}
string DtCreateName(DatatypeCtor ctor) {
Expand Down
25 changes: 25 additions & 0 deletions Test/git-issues/git-issue-2903.dfy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// RUN: %dafny /compile:0 "%s" > "%t"
alex-chew marked this conversation as resolved.
Show resolved Hide resolved
// RUN: %dafny /noVerify /compile:4 /spillTargetCode:2 /compileTarget:cs "%s" >> "%t"
// RUN: %dafny /noVerify /compile:4 /spillTargetCode:2 /compileTarget:js "%s" >> "%t"
// RUN: %dafny /noVerify /compile:4 /spillTargetCode:2 /compileTarget:go "%s" >> "%t"
// RUN: %dafny /noVerify /compile:4 /spillTargetCode:2 /compileTarget:java "%s" >> "%t"
// RUN: %dafny /noVerify /compile:4 /spillTargetCode:2 /compileTarget:py "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"

module A {
datatype Wrapper = Wrap(val: int)
}

module B {
datatype Wrapper = Wrap
}

module Main {
import opened A
import B

method Main() {
var Wrap(x) := Wrap(0);
expect x == 0;
}
}
12 changes: 12 additions & 0 deletions Test/git-issues/git-issue-2903.dfy.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

Dafny program verifier finished with 0 verified, 0 errors

Dafny program verifier did not attempt verification

Dafny program verifier did not attempt verification

Dafny program verifier did not attempt verification

Dafny program verifier did not attempt verification

Dafny program verifier did not attempt verification