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

Automatic Test Gen: Type Parameter Translation #2221

Open
tbean79 opened this issue Jun 7, 2022 · 0 comments
Open

Automatic Test Gen: Type Parameter Translation #2221

tbean79 opened this issue Jun 7, 2022 · 0 comments
Labels
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

Comments

@tbean79
Copy link

tbean79 commented Jun 7, 2022

Dafny version: 3.6.0.40511

When running /generateTestMode:Block on this Dafny method

module Test {
  method IsEvenLength<K, V>(m: map<K, V>) returns (isEven: bool)
  {
    if (|m| % 2 == 0) {
      return true;
    } else {
      return false;
    }
  }
}

the tests generated take on this form

method test0() returns (r0:bool)  {
r0 := Test.IsEvenLength(null, null, map[null := null, null := null, null := null]);
}

The first two parameters are meant to be type parameters, but instead get lumped in with the other parameters. This occurs because the instrumented boogie implementation signature of IsEvenLength looks like this:

implementation Impl$$Test.__default.IsEvenLength(Test._default.IsEvenLength$K: Ty, Test._default.IsEvenLength$V: Ty, m#0: Map Box Box) returns (isEven#0: bool, $_reverifyPost: bool)

Would there be any simple means of preserving the List<TypeParameter> TypeArgs; of the Dafny Method so that TestMethod.cs is aware of how many there are when it builds the call to the test method? I see this as difficult because the ProgramModifier is a visitor of the BoogieAST, not the Dafny AST.

@MikaelMayer MikaelMayer added misc: tests New tests or tutorials part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label and removed misc: tests New tests or tutorials labels Jun 8, 2022
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 part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag
Projects
None yet
Development

No branches or pull requests

2 participants