View Source Changelog

Changelog

  • 0.13.7 -

    • Fixes: (c.f. #195)
      • Fixing new compiler warnings (stricter checks, deprecation warnings) of Elixir v1.16/v1.17
      • Ensuring map order shown in most output is sorted, esp. when creating fixed_map/1s (including structs). This ensures output of inspect(my_type) and type error formatting should be identical between OTP <= 25 and OTP 26+
  • 0.13.6 -

    • Support for Elixir v1.17.x:
      • Fix an oversight in the pre-expander now that there was a slight change to the Elixir AST format. Thank you, @skwerlman! (c.f. #190)
      • Fixing a bunch of compile-time warnings. Amongst them, a reordering of split function heads (Thank you, @ulfurinn! c.f. #191)
    • Fixing some documentation typos, Thank you, @kianmeng! (c.f. #179)
  • 0.13.5 -

    • Support for Elixir v1.15.x. Thank you so much for your guidance and help, @josevalim! (c.f. #185, #186)
      • This required turning off part of TypeCheck's self-usage ('dogfooding'). This change should be temporary and will be re-introduced in a future version (c.f. #187).
  • 0.13.4 -

    • No code changes, but two small improvements to the documentation:
      • Changelog has been split off from the README file.
      • A link to Marten's ElixirConf EU 2022 talk about TypeCheck has been added.
  • 0.13.3 -

    • Fixes:
      • Ensures that TypeCheck can be used in Erlang-style modules (that do not start with 'Elixir.') (c.f. #174).
  • 0.13.2 -

    • Fixes:
      • Fixes issue when unions are used as type arguments in remote types. Than you very much, @dvic! (c.f. #164).
  • 0.13.1 -

    • Fixes:
      • Fixes issues with aliases to remote types not being followed. (c.f. #160)
  • 0.13.0 -

    • Additions:
      • Support for maps with multiple optional atom keys. Thank you very much, @dvic! (c.f. #165)
    • Fixes:
      • Fixes 'Enumerable not implemented' crash when passing a struct to a type expecting a fixed map. (c.f. #161)
  • 0.12.4 -

    • Fixes:
      • Allow syntax %{String.t() => any()} as shorthand for %{required(String.t()) => any()}. (c.f. #152)
      • Situations in which the fully qualified name of a type defined in the current module were not picked up (Example.t() not being found inside specs in Example. even though Example defined a type called t()). (c.f. #154)
      • A problem with using types with type guards in other modules. (c.f. #147)
  • 0.12.3 -

    • Fixes:
      • Compatibility problems with Elixir v1.14. (Code.Identifier.inspect_as_key, working with the AST of imported functions) Thank you very much, @marcandre! (c.f. #150)
  • 0.12.2 -

    • Fixes:
      • Compilation error in a new Phoenix 1.16 project. Thank you very much, @assimelha! (c.f. #114)
  • 0.12.1 -

    • Performance:
      • Significant reduction on generated code size of runtime type checks. This will speed up compilation roughly ~10-50%.
    • Fixes:
      • No longer use white ANSI color in exception formatting, ensuring messages of the DefaultFormatter are also visible on white backgrounds (Livebook, anyone? :D)
      • Skip OTP app lookup (used to fetch per OTP app compile-time configuration) if we're not compiled inside an OTP app (such as inside a Livebook).
      • Improve generator for Regex.t() to generate only correct regular expressions. Thank you very much, @skwerlman!(c.f. #133)
  • 0.12.0 -

    • Additions:
      • The default options used are now fetched from the application configuration. This means that you can configure a default for your app as well as for each of your dependencies(!) by adding config :app_name, :type_check [...] to your configuration file(s). (c.f. #61)
      • TypeCheck.External module, with functions to work with typespecs in modules outside of your control. Thank you very much, @orsinium! (c.f. #113)
        • fetch_spec to build a TypeCheck type from any function that has a @spec.
        • fetch_type to build a TypeCheck type from any @type.
        • enforce_spec! to wrap a call to any function that has a @spec with a runtime type-check on the input parameters and return value.
        • apply and apply! to wrap a call to any function with the function spec type that you give it.
      • TypeCheck.Defstruct.defstruct!, a way to combine defstruct, @enforce_keys and the creation of the struct's type, reducing boilerplate and the possibility of mistakes. (c.f. #118)
    • Fixes:
      • Long-standing issue where Dialyzer would sometimes complain in apps using TypeCheck is resolved. (c.f. #95)
      • Creation of the new maybe_nonempty_list type will no longer get stuck in an infinite loop on creation. (c.f. #120)
  • 0.11.0 -

    • Additions:
      • Support for fancier map syntaxes:
        • %{required(key_type) => value_type} Maps with a single kind of required key-value type.
        • %{optional(key_type) => value_type} Maps with a single kind of optional key-value type.
        • %{:some => a(), :fixed => b(), :keys => c(), optional(atom()) => any()} Maps with any number of fixed keys and a single optional key-value type.
        • TypeCheck now supports nearly all kinds of map types that see use. Archaic combinations of optional and required are not supported, but also not very useful types in practice.
        • Because of this, the inspection of the builtin type map(key, value) has been changed to look the same as an optional map. This is a minor backwards-incompatible change.
      • Desugaring %{} has changed from 'any map' to 'the empty map' in line with Elixir's Typespecs. This is a minor backwards-incompatible change.
      • Support for the builtin types port(), reference() and (based on these) identifier().
      • Support for the builtin type struct().
      • Support for the builtin type timeout().
      • Support for the builtin type nonempty_charlist() and maybe_improper_list and (based on these) iolist() and iodata().
      • Adding types depending on these builtins to the default type overrides. We now support all modules of the full standard library!
      • TypeCheck.Credo.Check.Readability.Specs: an opt-in alternative Credo check which will check whether all functions have either a @spec! or 'normal' @spec. (Fixes #102).
  • 0.10.8 -

    • Fixes:
      • Ensures that the Inspect protocol is properly implemented for sized bitstring types (c.f. #104). Thank you very much, @trarbr!
  • 0.10.7 -

    • Fixes:
      • Ensures fixed-maps are checked for superfluous keys (c.f. #96). Thank you very much, @spatrik!
  • 0.10.6 -

    • Fixes:
      • Fixes issue where Dialyzer would sometimes complain about the generated return-type checking code if the implementation of the function itself was trivial. (c.f. #85).
  • 0.10.5 -

    • Additions:
      • Support for the builtin types of the System module. Thank you, @paulswartz!
  • 0.10.4 -

    • Fixes:
      • Fixes issue where sometimes results of specs returning a struct would remove some or all struct fields. (c.f. #78)
      • Related: Ensures that when a @type! containing a %__MODULE__{} is used before that module's defstruct, a clear CompileError is created (c.f. #83).
  • 0.10.3 -

    • Fixes:
      • Fixes issue when TypeCheck specs were used inside a defprotocol module or other modules where the normal def/defp macros are hidden/overridden.
  • 0.10.2 -

    • Fixes:
      • Fixes issue where FixedMaps would accept maps any maps (even those missing the required keys) sometimes. (c.f. #74)
  • 0.10.1 -

    • Fixes:
      • Swaps Murmur out for Erlang's builtin :erlang.phash2/2 to generate data for function-types, allowing the removal of the optional dependency on the :murmur library.
  • 0.10.0 -

    • Additions
      • Support for function-types (for typechecks as well as property-testing generators):
        • (-> result_type)
        • (...-> result_type)
        • (param_type, param2_type -> result_type)
    • Fixes:
      • Wrapping private functions no longer make the function public. (c.f. #64)
      • Wrapping macros now works correctly. (also related to #64)
      • Using __MODULE__ inside a struct inside a type now expands correctly. (c.f. #66)
  • 0.9.0 -

    • Support for bitstring type syntax: <<>>, <<_ :: size>>, <<_ :: _ * unit>>, <<_ :: size, _ :: _ * unit>> (both as types and as generators)
  • 0.8.2 -

    • Fixed compiler warnings when optional dependency StreamData is not installed.
    • Fixed pretty-printing of typedoc of opaque types.
  • 0.8.1 -

    • Improved documentation with a page comparing TypeCheck with Elixir's plain typespecs. (Thank you very much, @baldwindavid )
    • Addition of missing override for the type t Range.t/0. (Thank you very much, @baldwindavid )
  • 0.8.0 -

    • Fixes prettyprinting of TypeCheck.Builtin.Range.
    • Addition of require TypeCheck.Type to use TypeCheck so there no longer is a need to call this manually if you want to e.g. use TypeCheck.Type.build/1.
    • Pretty-printing of types and TypeError output in multiple colors.
    • Nicer indentation of errors.
    • named types are now printed in abbreviated fashion if they are repeated multiple times in an error message. This makes a nested error message much easier to read, especially for larger specs.
    • [type] no longer creates a fixed_list(type) but instead a list(type) (just as Elixir's own typespecs.)
    • Support for [...] and [type, ...]as alias for nonempty_list() and nonempty_list(type) respectively.
    • Remove support for list literals with multiple elements.
    • Improved documentation. Thank you, @0ourobor0s!
  • 0.7.0 - Addition of the option enable_runtime_checks. When false, all runtime checks in the given module are completely disabled.

    • Adding DateTime.t to the default overrides, as it was still missing.
  • 0.6.0 - Addition of spectest & 'default overrides' Elixir's standard library types:

    • Adding TypeCheck.ExUnit, with the function spectest to test function-specifications.
      • Possibility to use options :except, :only, :initial_seed.
      • Possibility to pass custom options to StreamData.
    • Adding TypeCheck.DefaultOverrides with many sub-modules containing checked typespecs for the types in Elixir's standard library (75% done).
      • Ensure that these types are correct also on older Elixir versions (1.9, 1.10, 1.11)
    • By default load these 'DefaultOverrides', but have the option to turn this behaviour off in TypeCheck.Option.
    • Nice generators for Enum.t, Collectable.t, String.t.
    • Support for the builtin types:
      • pid()
      • nonempty_list(), nonempty_list(type).
    • Allow use TypeCheck in IEx or other non-module contexts, to require TypeCheck and import TypeCheck.Builtin in the current scope (without importing/using the macros that only work at the module level.)
    • The introspection function __type_check__/1 is now added to any module that contains a use TypeCheck.
    • Fixes the Inspect implementation of custom structs, by falling back to Any, which is more useful than attempting to use a customized implementation that would try to read the values in the struct and failing because the struct-type containing types in the fields.
    • Fixes conditional compilation warnings when optional dependency :stream_data was not included in your project.
  • 0.5.0 - Stability improvements:

    • Adding Typecheck.Option debug: true, which will (at compile-time) print the checks that TypeCheck is generating.
    • Actually autogenerate a @spec, which did not yet happen before.
    • When writing @autogen_typespec false, no typespec is exported for the next @type!/@opaque/@spec! encountered in a module.
    • Code coverage increased to 85%
    • Bugfixes w.r.t. generating typespecs
    • Fixes compiler-warnings on unused named types when using a type guard. (c.f. #25)
    • Fixes any warnings that were triggered during the test suite before.
  • 0.4.0 - Support for impl(ProtocolName) to accept any type implementing a particular protocol.

    • Also adds rudimentary support for overriding remote types.
    • Bugfix when inspecting lazy( ...)-types.
  • 0.3.2 - Support for unquote fragments inside types and specs. (c.f. #39)

  • 0.3.1 - Fixed link in the documentation.

  • 0.3.0 - Improve DefaultFormatter output when used with long function- or type-signatures (c.f. #32). Also, bugfix for Builtin.tuple/1.

  • 0.2.3 - Bugfix release: Ensure TypeCheck compiles on Elixir v1.11 (#30), Ensure StreamData truly is an optional dependency (#27).

  • 0.2.2 - Support for literal strings should no longer break in Elixir's builtin typespecs.

  • 0.2.1 - Improved parsing of types that have a type-guard at the root level. (c.f. #24), support for custom generators.

  • 0.2.0 - Improved (and changed) API that works better with the Elixir formatter: Use @type!/@spec! instead, support named types in specs.

  • 0.1.2 - Added missing keyword type to TypeCheck.Builtin (#20)

  • 0.1.1 - Fixing some documentation typos

  • 0.1.0 - Initial Release