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: No more mention of reveal lemmas when implementing opaque functions in traits #2974

Merged
merged 6 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
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: 2 additions & 0 deletions Source/DafnyCore/Resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9458,6 +9458,8 @@ void InheritedTraitMembers(TopLevelDeclWithMembers cl) {
} else if (Attributes.Contains(member.Attributes, "extern")) {
// Extern functions do not need to be reimplemented.
// TODO: When `:extern` is separated from `:compile false`, this should become `:compile false`.
} else if (member is Lemma && Attributes.Contains(member.Attributes, "opaque_reveal")) {
// reveal lemmas do not need to be reimplemented
} else {
reporter.Error(MessageSource.Resolver, cl.tok, "{0} '{1}' does not implement trait {2} '{3}.{4}'", cl.WhatKind, cl.Name, member.WhatKind, member.EnclosingClass.Name, member.Name);
}
Expand Down
8 changes: 8 additions & 0 deletions Test/git-issues/git-issue-2612.dfy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %dafny_0 /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

trait T {
predicate {:opaque} True() { true }
}

class C extends T {}
2 changes: 2 additions & 0 deletions Test/git-issues/git-issue-2612.dfy.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Dafny program verifier finished with 0 verified, 0 errors
1 change: 1 addition & 0 deletions docs/dev/news/2612.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No more mention of reveal lemmas when implementing opaque functions in traits