-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from hacspec/type-ascription
feat(engine/import): support `ValueTypeAscription`
- Loading branch information
Showing
5 changed files
with
113 additions
and
3 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
54 changes: 54 additions & 0 deletions
54
test-harness/src/snapshots/toolchain__slices into-coq.snap
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,54 @@ | ||
--- | ||
source: test-harness/src/harness.rs | ||
expression: snapshot | ||
info: | ||
kind: | ||
Translate: | ||
backend: coq | ||
info: | ||
name: slices | ||
manifest: slices/Cargo.toml | ||
description: ~ | ||
spec: | ||
optional: false | ||
broken: false | ||
issue_id: ~ | ||
positive: true | ||
snapshot: | ||
stderr: true | ||
stdout: true | ||
include_flag: ~ | ||
backend_options: ~ | ||
--- | ||
exit = 0 | ||
stderr = ''' | ||
Compiling slices v0.1.0 (WORKSPACE_ROOT/slices) | ||
Finished dev [unoptimized + debuginfo] target(s) in XXs''' | ||
[stdout] | ||
diagnostics = [] | ||
|
||
[stdout.files] | ||
"Slices.v" = ''' | ||
(* File automatically generated by Hacspec *) | ||
From Hacspec Require Import Hacspec_Lib MachineIntegers. | ||
From Coq Require Import ZArith. | ||
Import List.ListNotations. | ||
Open Scope Z_scope. | ||
Open Scope bool_scope. | ||
|
||
(*Not implemented yet? todo(item)*) | ||
|
||
Definition v_VERSION : seq int8 := | ||
unsize (array_from_list [(@repr WORDSIZE8 118); | ||
(@repr WORDSIZE8 49)]). | ||
|
||
Definition do_something (_ : seq int8) : unit := | ||
tt. | ||
|
||
Definition r#unsized (_ : nseq (seq int8) TODO: Int.to_string length) : unit := | ||
tt. | ||
|
||
Definition sized (x : nseq (nseq int8 TODO: Int.to_string length) TODO: Int.to_string length) : unit := | ||
r#unsized (array_from_list [unsize (x.[(@repr WORDSIZE32 0)])]). | ||
''' |
51 changes: 51 additions & 0 deletions
51
test-harness/src/snapshots/toolchain__slices into-fstar.snap
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,51 @@ | ||
--- | ||
source: test-harness/src/harness.rs | ||
expression: snapshot | ||
info: | ||
kind: | ||
Translate: | ||
backend: fstar | ||
info: | ||
name: slices | ||
manifest: slices/Cargo.toml | ||
description: ~ | ||
spec: | ||
optional: false | ||
broken: false | ||
issue_id: ~ | ||
positive: true | ||
snapshot: | ||
stderr: true | ||
stdout: true | ||
include_flag: ~ | ||
backend_options: ~ | ||
--- | ||
exit = 0 | ||
stderr = ''' | ||
Compiling slices v0.1.0 (WORKSPACE_ROOT/slices) | ||
Finished dev [unoptimized + debuginfo] target(s) in XXs''' | ||
[stdout] | ||
diagnostics = [] | ||
|
||
[stdout.files] | ||
"Slices.fst" = ''' | ||
module Slices | ||
#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" | ||
open Core | ||
open FStar.Mul | ||
|
||
let v_VERSION: t_Slice u8 = | ||
Rust_primitives.unsize (let list = [118uy; 49uy] in | ||
FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 2); | ||
Rust_primitives.Hax.array_of_list 2 list) | ||
|
||
let do_something (_: t_Slice u8) : Prims.unit = () | ||
|
||
let r#unsized (_: t_Array (t_Slice u8) (sz 1)) : Prims.unit = () | ||
|
||
let sized (x: t_Array (t_Array u8 (sz 4)) (sz 1)) : Prims.unit = | ||
r#unsized (let list = [Rust_primitives.unsize (x.[ sz 0 ] <: t_Array u8 (sz 4)) <: t_Slice u8] in | ||
FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1); | ||
Rust_primitives.Hax.array_of_list 1 list) | ||
''' |
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