Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/bug-reports/ExtractPulseFnIface.c.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* krml header omitted for test repeatability */


#include "ExtractPulseFnIface.h"

extern krml_checked_int_t Prims_op_Addition(krml_checked_int_t x, krml_checked_int_t y);

krml_checked_int_t ExtractPulseFnIface_pure_add(krml_checked_int_t x, krml_checked_int_t y)
{
return Prims_op_Addition(x, y);
}

krml_checked_int_t ExtractPulseFnIface_pulse_read_ref(krml_checked_int_t *r)
{
return *r;
}

19 changes: 19 additions & 0 deletions test/bug-reports/ExtractPulseFnIface.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module ExtractPulseFnIface
#lang-pulse

open Pulse.Lib.Pervasives
open Pulse.Lib.Reference
module R = Pulse.Lib.Reference

let pure_add (x y : int) : int = x + y

fn pulse_read_ref
(r: ref int)
(#v: Ghost.erased int)
requires R.pts_to r v
returns x: int
ensures R.pts_to r v ** pure (x == Ghost.reveal v)
{
let x = !r;
x
}
21 changes: 21 additions & 0 deletions test/bug-reports/ExtractPulseFnIface.fsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module ExtractPulseFnIface
#lang-pulse

(** Interface for ExtractPulseFnIface.
Tests that a Pulse fn declared in .fsti extracts to C correctly.
Regression test: previously, fn declarations in .fsti were not
recognized by the interleaver, causing the implementation to be
tagged KrmlPrivate and silently dropped by KaRaMeL. *)

open Pulse.Lib.Pervasives
open Pulse.Lib.Reference
module R = Pulse.Lib.Reference

val pure_add (x y : int) : int

fn pulse_read_ref
(r: ref int)
(#v: Ghost.erased int)
requires R.pts_to r v
returns x: int
ensures R.pts_to r v ** pure (x == Ghost.reveal v)
Loading