-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes # <!-- Is this a user-visible change? Remember to update RELEASE_NOTES.md --> <!-- Is this a bug fix? Remember to include a test in Test/git-issues/ --> <!-- Is this a bug fix for an issue introduced in the latest release? Mention this in the PR details and ensure a patch release is considered --> <!-- Does this PR need tests? Add them to `Test/` or to `Source/*.Test/…` and run them with `dotnet test` --> <!-- Are you moving a large amount of code? Read CONTRIBUTING.md to learn how to do that while maintaining git history --> <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
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %exits-with 2 %dafny /compile:0 "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
trait YT { | ||
const f: Y -> nat | ||
} | ||
|
||
class Y extends YT { | ||
constructor(f: YT -> nat) | ||
ensures this.f == f | ||
{ | ||
this.f := f; | ||
} | ||
} | ||
|
||
method Main() | ||
ensures false | ||
{ | ||
// error: knot.f calls itself without decreasing | ||
var knot := new Y((x: YT) => if x is Y then 1 + x.f(x as Y) else 0); | ||
var a := knot.f(knot); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Knot16.dfy(12,11): Error: To prevent the creation of non-terminating functions, storing functions into an object's fields that reads the object is disallowed | ||
1 resolution/type errors detected in Knot16.dfy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %exits-with 2 %dafny /compile:0 "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
trait YT { | ||
const f: YT -> nat | ||
} | ||
|
||
class Y extends YT { | ||
constructor(f: YT -> nat) | ||
ensures this.f == f | ||
{ | ||
this.f := f; | ||
} | ||
} | ||
|
||
method Main() | ||
ensures false | ||
{ | ||
// error: knot.f calls itself without decreasing | ||
var knot := new Y((x: YT) => if x is Y then 1 + x.f(x as Y) else 0); | ||
var a := knot.f(knot); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Knot17.dfy(12,11): Error: To prevent the creation of non-terminating functions, storing functions into an object's fields that reads the object is disallowed | ||
1 resolution/type errors detected in Knot17.dfy |