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

[Bug]: Preservation of {:opaque} not verified on classes implementing a trait #3040

Closed
cpitclaudel opened this issue Nov 10, 2022 · 1 comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking

Comments

@cpitclaudel
Copy link
Member

Dafny version

latest

Code to produce this issue

trait TTT {
  function {:opaque} FFF(): int
}

class CCC extends TTT {
  function FFF() : int { 412 }
}

method M0() {
  var c := new CCC;
  assert c.FFF() == 412; // This passes
}

method M1() {
  var c := new CCC;
  reveal c.FFF();
  assert c.FFF() == 412; // This fails
}

Command to run and results

No response

What happened?

This is a follow up to the fix in #2974 . The difference between M0 and M1 in the example above is the type inference:

method M0'() {
  var c: TTT := new CCC;
  assert c.FFF() == 412; // This fails
}

method M1'() {
  var c: CCC := new CCC;
  reveal c.FFF();
  assert c.FFF() == 412; // This passes
}

What type of Operating System are you seeing the problem on?

Other

@cpitclaudel cpitclaudel added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking labels Nov 10, 2022
@fabiomadge fabiomadge changed the title [Bug]: [Bug]: Preservation of {:opaque} not verified on classes implementing a trait Nov 15, 2022
@MikaelMayer
Copy link
Member

Verification being inherently static, if we can't know what is the reveal lemma to invoke (which requires dynamic dispatch), we can't actually reveal a function defined on a trait. We need to have a function body to be able to declare a function opaque.
This remark made it possible to close one long standing issue #4546
I'm closing this thread now.

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: resolver Resolution and typechecking
Projects
None yet
Development

No branches or pull requests

2 participants