Skip to content

Commit

Permalink
fix(engine/f*): {| ... |} for trait bounds on types
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Jul 10, 2024
1 parent 9f056df commit a17cd49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions engine/backends/fstar/fstar_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,9 @@ struct
type t = { kind : kind; ident : F.Ident.ident; typ : F.AST.term }

let make_explicit x = { x with kind = Explicit }
let make_implicit x = { x with kind = Implicit }

let implicit_to_explicit x =
if [%matches? Tcresolve] x.kind then x else make_explicit x

let of_generic_param span (p : generic_param) : t =
let ident = plocal_ident p.ident in
Expand Down Expand Up @@ -1034,7 +1036,7 @@ struct
F.AST.TyconRecord
( F.id @@ U.Concrete_ident_view.to_definition_name name,
FStarBinder.of_generics e.span generics
|> List.map ~f:FStarBinder.make_explicit
|> List.map ~f:FStarBinder.implicit_to_explicit
|> List.map ~f:FStarBinder.to_binder,
None,
[],
Expand Down Expand Up @@ -1101,7 +1103,7 @@ struct
F.AST.TyconVariant
( F.id @@ U.Concrete_ident_view.to_definition_name name,
FStarBinder.of_generics e.span generics
|> List.map ~f:FStarBinder.make_explicit
|> List.map ~f:FStarBinder.implicit_to_explicit
|> List.map ~f:FStarBinder.to_binder,
None,
constructors );
Expand Down Expand Up @@ -1299,7 +1301,7 @@ struct
List.map
~f:
FStarBinder.(
of_generic_param e.span >> make_explicit >> to_binder)
of_generic_param e.span >> implicit_to_explicit >> to_binder)
generics.params
in
F.AST.TyconRecord (name_id, bds, None, [], fields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ module Traits.Type_alias_bounds_issue_707_
open Core
open FStar.Mul

type t_StructWithGenericBounds (v_T: Type0) (i1: Core.Clone.t_Clone v_T) =
type t_StructWithGenericBounds (v_T: Type0) {| i1: Core.Clone.t_Clone v_T |} =
| StructWithGenericBounds : v_T -> t_StructWithGenericBounds v_T
'''
"Traits.Unconstrainted_types_issue_677_.fst" = '''
Expand Down

0 comments on commit a17cd49

Please sign in to comment.