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

Bad cast involving variant datatypes #1815

Closed
fabiomadge opened this issue Feb 11, 2022 · 0 comments · Fixed by #1818
Closed

Bad cast involving variant datatypes #1815

fabiomadge opened this issue Feb 11, 2022 · 0 comments · Fixed by #1818
Assignees
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c# Dafny's C# transpiler and its runtime part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag

Comments

@fabiomadge
Copy link
Collaborator

Running the compiled version of this program results in a failed cast. The cast is emitted to support the match statement.

datatype X<+U> = X(x: U)

trait Tr {}
class Cl extends Tr {
    constructor () {}
}

method Main() {
    var cl := new Cl();
    var e: X<Tr> := X(cl);
    match e
    case X(tr) => return;
}
@fabiomadge fabiomadge added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag lang: c# Dafny's C# transpiler and its runtime labels Feb 11, 2022
@fabiomadge fabiomadge self-assigned this Feb 11, 2022
fabiomadge added a commit that referenced this issue Feb 15, 2022
Fixes #1815 by replacing a manual datatype deconstruction by the one we already export though the interface. This made exporting unnamed destructors necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c# Dafny's C# transpiler and its runtime part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant