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

Invalid C# codegen for tail-recursive member functions that recurse on this #2173

Closed
cpitclaudel opened this issue May 27, 2022 · 0 comments · Fixed by #2205
Closed

Invalid C# codegen for tail-recursive member functions that recurse on this #2173

cpitclaudel opened this issue May 27, 2022 · 0 comments · Fixed by #2205
Assignees
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed 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

@cpitclaudel
Copy link
Member

cpitclaudel commented May 27, 2022

Input:

datatype T = Leaf(x: int) | T(t: T) {
  function method {:tailrecursion} TR() : int {
    if Leaf? then 0
    else t.TR()
  }
}

Output:

Dafny /spillTargetCode:3 /noVerify /compile:4 test.dfy 

Dafny program verifier did not attempt verification
Wrote textual form of target program to test.cs
Errors compiling program into test
(1873,17): error CS0266: Cannot implicitly convert type '_module._IT' to '_module.T'. An explicit conversion exists (are you missing a cast?)
@cpitclaudel cpitclaudel added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c# Dafny's C# transpiler and its runtime crash Dafny crashes on this input, or generates malformed code that can not be executed part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag labels May 27, 2022
@cpitclaudel cpitclaudel self-assigned this Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed 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