package pyre-ast

  1. Overview
  2. Docs

This module provides a type that represents a Python type parameter item. See PEP 695.

It can only appear on the following statements: Statement.t.function_def, Statement.t.async_function_def, Statement.t.class_def, and Statement.t.type_alias. In the source texts, type parameters are usually surrounded by a pair of square brackets.

type ('expr, 'identifier, 'location, 'type_param) t = {
  1. type_var : location:'location -> name:'identifier -> bound:'expr option -> 'type_param;
    (*

    Represent a normal type variables, e.g. T. The optional bound parameter can be used to specify either an upper bound (e.g. T: int) or a constrained type (e.g. T: (str, bytes))

    *)
  2. param_spec : location:'location -> name:'identifier -> 'type_param;
    (*

    Represent a param spec type variable, e.g. **P. For meaning of param spec, consult PEP 612.

    *)
  3. type_var_tuple : location:'location -> name:'identifier -> 'type_param;
    (*

    Represent a type var tuple variable, e.g. *T. For meaning of type var tuple, consult PEP 646.

    *)
}
val make : type_var:(location:'a -> name:'b -> bound:'c option -> 'd) -> param_spec:(location:'a -> name:'b -> 'd) -> type_var_tuple:(location:'a -> name:'b -> 'd) -> unit -> ('c, 'b, 'a, 'd) t

Constructor of t.

OCaml

Innovation. Community. Security.