How much does the elixir compiler enforce if a @spec annotation is used on a function

When updating to elixir 1.10.2 I started to get a compilation warning because a @spec annotation had been added to a function and was referencing a type that hadn’t been defined (same as this issue https://github.com/elixir-lang/elixir/issues/9758).

I use dialyzer to do static analysis but I’m now curious, what checks does the elixir compiler apply to @spec annotations? (I’d previously assumed pretty much nothing aside from behaviours)

None. The error you have see is probably due to changes in how the types were compiled.