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: Optional pre-type won't cause a crash anymore #5442

Merged
merged 9 commits into from
May 17, 2024
Prev Previous commit
Next Next commit
Fix: Optional pre-type won't cause a crash anymore
  • Loading branch information
MikaelMayer committed May 14, 2024
commit a44d8b1bce756e8b298467c0e5d0d48af2bd14c9
2 changes: 2 additions & 0 deletions Source/DafnyCore/Resolver/PreType/PreTypeConstraints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ public enum CommonConfirmationBag {
preType = preType.Normalize();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to ConfirmConstraint, or update its signature (parameter names) to make it clear what it does? I don't understand the meaning of the parameters or return value by looking at just its signature and comment.

Copy link
Member Author

@MikaelMayer MikaelMayer May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't, as I don't understand the code at a level high enough to do that. I don't have a mental model of what ConfirmConstraint does, nor about what code context it was called with. I'll leave it for @RustanLeino to comment on it.

if (preType is PreTypeProxy) {
return false;
} else if (preType is UnusedPreType) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to the class UnusedPreType ?

return true;
}

var pt = (DPreType)preType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %exits-with 2 %baredafny verify %args "%s" > "%t"
// RUN: %exits-with 2 %baredafny verify %args --type-system-refresh "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

ghost function f2(items: set<nat>): (r:nat)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

Dafny program verifier finished with TODO verified, TODO errors
git-issue-5369.dfy(20,2): Error: expression is not allowed to invoke a method (m)
git-issue-5369.dfy(20,40): Error: expression is not allowed to invoke a method (m)
git-issue-5369.dfy(20,42): Error: arguments to <= must have a common supertype (got int and (unused -- call to method m))
git-issue-5369.dfy(20,4): Error: expecting element type to be assignable to nat (got (unused -- call to method m))
git-issue-5369.dfy(32,9): Error: unresolved identifier: ThereIsASmallest
5 resolution/type errors detected in git-issue-5369.dfy
1 change: 1 addition & 0 deletions docs/dev/news/5369.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Optional pre-type won't cause a crash anymore
Loading