Skip to content

Commit

Permalink
compiler: add a test file for #22
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilin Chen authored and Zilin Chen committed Oct 26, 2016
1 parent a34cac3 commit 82c509c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions cogent/tests/pass_ticket-e22-3.cogent
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
type ExState
type RR c a b = (c, <Success a | Error b>)
type OSBuffer

type Ext2Superblock = {
inode_count : U32,
magic : U16
}

deserialise_Ext2Superblock: (ExState, OSBuffer!, U32) -> RR ExState (Ext2Superblock, U32) ()

free_Ext2Superblock : (ExState, Ext2Superblock take (..)) -> ExState
free_Ext2Superblock' : (ExState, Ext2Superblock) -> ExState

foo : #{ex: ExState, buf_super : OSBuffer} -> ExState
foo #{ex, buf_super} =
let (ex, res) = deserialise_Ext2Superblock (ex, buf_super, 0) !buf_super
in res
| Success (super, _) ->
let xxx = super.magic !super
in free_Ext2Superblock (ex, super) -- super is all-untaken
| Error () -> ex

0 comments on commit 82c509c

Please sign in to comment.