Skip to content

Commit

Permalink
compiler: further shrink test for #22.
Browse files Browse the repository at this point in the history
Once this one passes, should also try pass_ext2-mount.cogent
  • Loading branch information
Zilin Chen authored and Zilin Chen committed Mar 6, 2018
1 parent 3b57a04 commit 091ad40
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cogent/tests/pass_ticket-e22-4.cogent
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
type Result a b = <Success a | Error b>

type Option a
type WordArray a

type FsState = {
superblock_num : U32,
flags : U32,
prealloc_offsets : Option (WordArray U32)
}

malloc_FsState: () -> Result (FsState take (..)) ()

wordarray_create : all (a :< DS). () -> Result (WordArray a) ()

free_FsState : FsState take (..) -> ()

fs_mount: () -> Result FsState U32
fs_mount _ =
malloc_FsState ()
| Success state_t ->
let state_t = state_t { superblock_num = 1 }
in wordarray_create ()
| Success prealloc_offsets =>
let state = state_t {
flags = 2,
prealloc_offsets = Some prealloc_offsets
}
in Success state
| Error _ ->
let _ = free_FsState state_t
in Error 1
| Error _ -> Error 2


0 comments on commit 091ad40

Please sign in to comment.