Skip to content

Commit

Permalink
Fix: Crash using subset type dafny-lang#4724 (dafny-lang#4825)
Browse files Browse the repository at this point in the history
### Description
Fix for issue dafny-lang#4724 

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
  • Loading branch information
jtristan authored Nov 29, 2023
1 parent f7ebf70 commit ae8b26d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Source/DafnyCore/AST/Expressions/DefaultValueExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public void FillIn(ModuleResolver resolver, Dictionary<DefaultValueExpression, W
var s = new DefaultValueSubstituter(resolver, visited, this.receiver, this.substMap, typeMap);
this.ResolvedExpression = s.Substitute(this.formal.DefaultValue);
visited[this] = WorkProgress.Done;

this.ResolvedExpression.Type = this.Type;
}

class DefaultValueSubstituter : Substituter {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %exits-with 4 %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

type seq31<T> = x: seq<T> | |x| <= 31

method TakeThis(x: seq31<int> := [])
{
TakeThis(); // Error: cannot prove termination; try supplying a decreases clause
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git-issue-4724.dfy(8,10): Error: cannot prove termination; try supplying a decreases clause

Dafny program verifier finished with 2 verified, 1 error
1 change: 1 addition & 0 deletions docs/dev/news/4724.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: correction of type inference for default expressions

0 comments on commit ae8b26d

Please sign in to comment.