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

Ensure type decls are types #3118

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion examples/tactics/NormLHS.fst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let norm_lhs steps : Tac unit =
| _ ->
fail "not an eq"

type unit_t = unit
let unit_t = unit

let tau () = norm_lhs [delta; hnf; weak]; trefl ()

Expand Down
2 changes: 1 addition & 1 deletion ocaml/fstar-lib/generated/FStar_PartialMap.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions ocaml/fstar-lib/generated/FStar_SMTEncoding_Solver.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ocaml/fstar-lib/generated/FStar_ToSyntax_ToSyntax.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/smtencoding/FStar.SMTEncoding.Solver.fst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ exception SplitQueryAndRetry
// The type definition is now in [FStar.Compiler.Util], since it needs to be visible to
// both the F# and OCaml implementations.

type z3_replay_result = either Z3.unsat_core, error_labels
let z3_result_as_replay_result = function
| Inl l -> Inl l
| Inr (r, _) -> Inr r
let recorded_hints : ref (option hints) = BU.mk_ref None
let replaying_hints: ref (option hints) = BU.mk_ref None

Expand Down
2 changes: 1 addition & 1 deletion src/tosyntax/FStar.ToSyntax.ToSyntax.fst
Original file line number Diff line number Diff line change
Expand Up @@ -3000,7 +3000,7 @@ let rec desugar_tycon env (d: AST.decl) (d_attrs:list S.term) quals tcs : (env_t
| None ->
if BU.for_some (function S.Effect -> true | _ -> false) quals
then Some teff
else None
else Some ktype
| Some k -> Some (desugar_term env' k) in
let t0 = t in
let quals = if quals |> BU.for_some (function S.Logic -> true | _ -> false)
Expand Down
4 changes: 4 additions & 0 deletions tests/bug-reports/Bug2933.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Bug2933

[@@expect_failure [189]]
type t = 123
2 changes: 1 addition & 1 deletion tests/micro-benchmarks/BinderAttributes.fst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let default_to (def : 'a) (x : option 'a) : Tot 'a =
| None -> def
| Some a -> a

type description (d : string) = ()
let description (d : string) = ()

type inductive_example =
| CaseExplicit : [@@@ description "x"] x:int -> [@@@ description "y"] y:string -> inductive_example
Expand Down
6 changes: 3 additions & 3 deletions tests/micro-benchmarks/MultipleAttributesBinder.fst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ type attr_value =
| String : v:string -> attr_value
| Int : v:int -> attr_value

type attr1 (v : string) = ()
type attr2 (v : int) = ()
type attr3 (v : attr_value) = ()
let attr1 (v : string) = ()
let attr2 (v : int) = ()
let attr3 (v : attr_value) = ()

let f (#[@@@ attr1 "imp"; attr2 1; attr3 (String "x")] x_imp:int) ([@@@ attr1 "exp"; attr2 2; attr3 (String "y")] y:string) : Tot unit =
()
Expand Down
2 changes: 1 addition & 1 deletion tests/micro-benchmarks/RecordFieldAttributes.fst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module RecordFieldAttributes

module T = FStar.Tactics.V2

type description (d : string) = ()
let description (d : string) = ()

type r =
{
Expand Down
2 changes: 1 addition & 1 deletion ulib/FStar.FiniteMap.Base.fst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open FStar.FiniteSet.Ambient
module T = FStar.Tactics.V2

// Finite maps
type map (a: eqtype) (b: Type u#b) = (keys: FSet.set a) & (setfun_t a b keys)
type map (a: eqtype) ([@@@ strictly_positive] b: Type u#b) = (keys: FSet.set a) & (setfun_t a b keys)

let domain (#a: eqtype) (#b: Type u#b) (m: map a b) : FSet.set a =
let (| keys, _ |) = m in
Expand Down
12 changes: 6 additions & 6 deletions ulib/FStar.IntegerIntervals.fst
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ type interval_type (x y:int) = z : Type0{ z == t:int{interval_condition x y t} }
type interval (x y: int) : interval_type x y = t:int{interval_condition x y t}

(* general finite integer intervals *)
type efrom_eto (x y: int) = interval (x+1) y
type efrom_ito (x y: int) = interval (x+1) (y+1)
type ifrom_eto (x y: int) = interval x y
type ifrom_ito (x y: int) = interval x (y+1)
type efrom_eto (x y: int) : interval_type _ _ = interval (x+1) y
type efrom_ito (x y: int) : interval_type _ _ = interval (x+1) (y+1)
type ifrom_eto (x y: int) : interval_type _ _ = interval x y
type ifrom_ito (x y: int) : interval_type _ _ = interval x (y+1)

(* Special case for naturals under k, to use in sequences, lists, arrays, etc *)
type under (k: nat) = interval 0 k
type under (k: nat) : interval_type 0 k = interval 0 k

(* If we define our intervals this way, then the following lemma comes for free: *)
private let closed_interval_lemma (x y:int) : Lemma (interval x (y+1) == ifrom_ito x y) = ()
Expand All @@ -55,7 +55,7 @@ let interval_size (#x #y: int) (interval: interval_type x y) : nat
= if y >= x then y-x else 0

(* when we want a zero-based index that runs over an interval, we use this *)
type counter_for (#x #y:int) (interval: interval_type x y) = under (interval_size interval)
type counter_for (#x #y:int) (interval: interval_type x y) : Type = under (interval_size interval)

(* special case for closed intervals, used in FStar.Algebra.CommMonoid.Fold *)
let closed_interval_size (x y: int) : nat = interval_size (ifrom_ito x y)
Expand Down
6 changes: 3 additions & 3 deletions ulib/FStar.PartialMap.fst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ module FStar.PartialMap

open FStar.FunctionalExtensionality

type t k v = k ^-> option v
type t (k:eqtype) ([@@@strictly_positive] v:Type u#a) = k ^-> option v

let empty _ _ = on_dom _ (fun _ -> None)
let literal f = on_dom _ (fun x -> f x)
let sel m x = m x
let upd m x y = on_dom _ (fun x1 -> if x1 = x then Some y else m x1)
let remove m x = on_dom _ (fun x1 -> if x1 = x then None else m x1)
let upd (#k:eqtype) #v m x y = on_dom _ (fun (x1:k) -> if x1 = x then Some y else m x1)
let remove (#k:eqtype) m x = on_dom _ (fun (x1:k) -> if x1 = x then None else m x1)

let sel_empty _ _ = ()
let sel_literal _ _ = ()
Expand Down
2 changes: 1 addition & 1 deletion ulib/experimental/FStar.OrdSet.fst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*)
module FStar.OrdSet

type ordset a f = l:(list a){sorted f l}
type ordset (a:eqtype) f = l:(list a){sorted f l}

let hasEq_ordset _ _ = ()

Expand Down
2 changes: 1 addition & 1 deletion ulib/experimental/FStar.Sequence.Base.fst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module FLT = FStar.List.Tot

/// Internally, we represent a sequence as a list.

type seq (ty: Type) = list ty
type seq ([@@@ strictly_positive] ty: Type u#a) = list ty

/// We represent the Dafny function `Seq#Length` with `length`:
///
Expand Down