-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapts channel encoding to allow assignable instead of equal message …
…types for channel send operations
- Loading branch information
Showing
3 changed files
with
43 additions
and
10 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
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,32 @@ | ||
package issue000695 | ||
|
||
type ChannelMsgType int | ||
|
||
const ChannelMsg1 = 42 | ||
const ChannelMsg2 ChannelMsgType = 43 | ||
|
||
pred sendInvariant(v ChannelMsgType) { | ||
true | ||
} | ||
|
||
requires acc(channel.SendChannel(), 1/2) | ||
requires channel.SendGivenPerm() == sendInvariant!<_!> | ||
requires channel.SendGotPerm() == PredTrue!<!> | ||
func sendMsg1(channel chan ChannelMsgType) { | ||
fold sendInvariant!<_!>(ChannelMsg1) | ||
fold PredTrue!<!>() | ||
assert acc(channel.SendChannel(), _) && sendInvariant!<_!>(ChannelMsg1) | ||
assert acc(channel.SendChannel(), _) && channel.SendGivenPerm()(ChannelMsg1) | ||
channel <- ChannelMsg1 | ||
} | ||
|
||
requires acc(channel.SendChannel(), 1/2) | ||
requires channel.SendGivenPerm() == sendInvariant!<_!> | ||
requires channel.SendGotPerm() == PredTrue!<!> | ||
func sendMsg2(channel chan ChannelMsgType) { | ||
fold sendInvariant!<_!>(ChannelMsg2) | ||
fold PredTrue!<!>() | ||
assert acc(channel.SendChannel(), _) && sendInvariant!<_!>(ChannelMsg2) | ||
assert acc(channel.SendChannel(), _) && channel.SendGivenPerm()(ChannelMsg2) | ||
channel <- ChannelMsg2 | ||
} |