Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some (possibly known) interleaving name resolution headaches #2020

Open
msprotz opened this issue Apr 22, 2020 · 0 comments
Open

Some (possibly known) interleaving name resolution headaches #2020

msprotz opened this issue Apr 22, 2020 · 0 comments

Comments

@msprotz
Copy link
Collaborator

msprotz commented Apr 22, 2020

This is a minimal repro from something that happened to me recently in HACL. Generally, it's oftentimes advised to not reuse field names within a single module; however, with the semantics of interleaving, I find myself either giving up on open entirely, which is tedious when projectors are involved, or adopting globally-unique field names for my records, which is not optimal either.

I'm not sure there's a good solution for this knowing the semantics of interleaving. CC @mtzguido since he's been helping out with name resolution recently.

Thanks,

Jonathan

jonathan@absinthe:/tmp $ cat A.fst
module A

type t = {
  key: int;
}
jonathan@absinthe:/tmp $ cat B.fsti
module B

open A

val t: Type0

let f (x: A.t): int = x.key
jonathan@absinthe:/tmp $ fstar.exe --cache_checked_modules A.fst
Verified module: A
All verification conditions discharged successfully
jonathan@absinthe:/tmp $ fstar.exe --cache_checked_modules B.fsti
Verified i'face (or impl+i'face): B
All verification conditions discharged successfully
jonathan@absinthe:/tmp $ # The fsti is properly interpreted when standalone, but ceases to work when interleaved with its fst -- the names of the fields in the fst shadow an open that exists in the fsti only
jonathan@absinthe:/tmp $ cat B.fst
module B

type t = {
  key: string;
}
jonathan@absinthe:/tmp $ fstar.exe --cache_checked_modules B.fst
B.fsti(7,22-7,23): (Error 189) Expected expression of type "B.t"; got expression "x" of type "A.t" (see also B.fsti(7,7-7,8))
1 error was reported (see above)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant