FStar.Char: move type into smaller FStar.Char.Type module#3408
Open
mtzguido wants to merge 3 commits intoFStarLang:masterfrom
Open
FStar.Char: move type into smaller FStar.Char.Type module#3408mtzguido wants to merge 3 commits intoFStarLang:masterfrom
mtzguido wants to merge 3 commits intoFStarLang:masterfrom
Conversation
Member
Author
|
This requires the following krml patch: diff --git a/include/krml/internal/types.h b/include/krml/internal/types.h
index e41b39be..71e8733f 100644
--- a/include/krml/internal/types.h
+++ b/include/krml/internal/types.h
@@ -28,7 +28,7 @@ typedef uint64_t FStar_UInt63_t, FStar_UInt63_t_;
typedef int64_t FStar_Int63_t, FStar_Int63_t_;
typedef double FStar_Float_float;
-typedef uint32_t FStar_Char_char;
+typedef uint32_t FStar_Char_Type_char;
typedef FILE *FStar_IO_fd_read, *FStar_IO_fd_write;
typedef void *FStar_Dyn_dyn;
diff --git a/krmllib/c/fstar_char.c b/krmllib/c/fstar_char.c
index f6931522..669220cc 100644
--- a/krmllib/c/fstar_char.c
+++ b/krmllib/c/fstar_char.c
@@ -3,6 +3,6 @@
#include "FStar_Char.h"
-FStar_Char_char FStar_Char_char_of_u32(uint32_t x) {
+FStar_Char_Type_char FStar_Char_Type_char_of_u32(uint32_t x) {
return x;
}
diff --git a/krmllib/c/fstar_string.c b/krmllib/c/fstar_string.c
index 1117bfa2..7e920134 100644
--- a/krmllib/c/fstar_string.c
+++ b/krmllib/c/fstar_string.c
@@ -28,7 +28,7 @@ Prims_string FStar_String_strcat(Prims_string s0, Prims_string s1) {
}
-krml_checked_int_t FStar_String_index_of(Prims_string s1, FStar_Char_char fc) {
+krml_checked_int_t FStar_String_index_of(Prims_string s1, FStar_Char_Type_char fc) {
if (fc > 127) {
KRML_HOST_PRINTF("FStar.Char.char overflow at %s:%d\n", __FILE__, __LINE__);
KRML_HOST_EXIT(252);
diff --git a/krmllib/c/lowstar_printf.c b/krmllib/c/lowstar_printf.c
index 409dfbf1..91a8a4ab 100644
--- a/krmllib/c/lowstar_printf.c
+++ b/krmllib/c/lowstar_printf.c
@@ -17,7 +17,7 @@
PRINTB(N, T, M2)
PRINT2 (string, Prims_string, "s", "s")
-PRINT2 (char, FStar_Char_char, PRIu32, PRIx32)
+PRINT2 (char, FStar_Char_Type_char, PRIu32, PRIx32)
PRINT2 (u8, uint8_t, PRIu8, PRIx8)
PRINT2 (u16, uint16_t, PRIu16, PRIx16)
PRINT2 (u32, uint32_t, PRIu32, PRIx32) |
Contributor
FWIW, we could eliminate the Classical.Sugar dependency by adding an interface to |
Member
Author
|
Good point! I did this for |
Contributor
|
I'm not sure if it's worth it to automate the interface-generation step, but I think a reasonable policy would be that interfaces shouldn't depend on "proof modules": |
This also tweaks the dependency analysis to only introduce a dependency to FStar.Char.Type when a character literal appears.
Char type moved
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reduces the dependencies that clients take on just for mentioning the char type or a character literal. Currently this brings in a lot to just check a module with
let x = 'a':With this PR: