ex_check v0.14: new automations & curated tools to supercharge your Elixir workflow
Understanding the Tradeoffs with Elixir Typespecs and Dialyzer
IntelliJ Elixir v11.9.2
Changelog
Bug Fixes
-
Protect from nested heredocs in documentation from stopping documentation’s heredoc as happens in
ModuleandEcto.Query.-
Use
~Sfor@moduledoctoo, in addition to@doc. -
Check if the documentation contains
“””or‘’’and use the opposite one as the promoter/terminator.-
If neither is used, use
“””. -
If both are used, use
“””, but then escape“””as\”\”\”.
-
If neither is used, use
- Trim trailing whitespace from documentation lines to match formatter output.
-
Use
-
Set
runIdemaxHeapSizeto7g- Set to the same I run my own IDE at, so the debugged instance isn’t any slower than the normal IDE when I need to do extended all day testing to trigger bugs.
-
Test that all
FormattingTestfiles can be parsed. -
YYINITIALis special - wrappers of the lexer assume that if inYYINITIAL, it is safe to shift the lexer over when there is an error, having{OPENING_CURLY}pushAndBegin(YYINITIAL)when it was either inYYINITIALorINTERPOLATIONmeans that the lexer looked like it was restartable when it really wasn’t. This code has been in the lexer for 6 years.-
When in
YYINITIAL,{no longer recurses intoYYINITIALas}does not need to be counted to determine if it is closing an interpolation. -
When in
INTERPOLATION,{entersINTERPOLATION_CURLYto allow counting and matching of}until it can exit and go back toINTERPOLATION, where}will exit the interpolation. -
When in
INTERPOLATION_CURLY,{enters another level ofINTERPOLATION_CURLYto allow counting and matching of}until it can exit and go up a level.
-
When in
-
The
}inYYINITIALdidyybegin(ADDITION_OR_SUBTRACTION_MAYBE), but it should have beenpushAndBegin(ADDITION_OR_SUBTRACTION)asADDITION_OR_SUBTRACTION_MAYBEor its following states all exit withhandleInLastState()orpopAndBegin(). This was not caught in #1859 because the extraYYINITIALfrompushAndBegin(YYINTIAL)hid the bug. -
Prevent nested
YYINITIALbugs in the future by erroring-
If trying to
pushAndBegin(YYINITIAL). -
If trying to
push(YYINITIAL)and the state stack is not empty
-
If trying to
-
Clear the state Stack when
ElixirFlexLexer#resetis called, as at the level of typing and pasting, theElixirFlexLexeris wrapped in many layers of lexers includingLexerEditorHighlighterwhere theElixirFlexLexeris no longer re-instantiated when there is no text, but instead,ElixirFlexLexer#resetis only called. This has always been an invariant violation since the stack state was added 7 years ago. It likely only became more apparent with the changes to +/- parsing in #1859 that made return-to-YYINITIALless likely.-
Since this
stack.clear()has to be manually added toElixirFlexLexer.java, which is generated fromElixir.flex,ResetTestis added to check that the code is still there.
-
Since this
-
For a reason I haven’t been able to explain, the
LexerEditorHighlighterstops working after:is typed at the start of an atom in certain situations, such as before)inside a function call, like when adding an argument. In this case, the old version of the lexer would mark)as aBAD_CHARACTERand continue to do so until an expected atom start of [a-zA-Z_],‘,“, or an operator occurred. Now, if an invalid atom start is matched, theATOM_STARTstate ends and the previous state handles the text, which in the function case mean)is parsed asCLOSING_PARENTHESIS. This change allows the highlighting to continue. I do not know if returningBAD_CHARACTERwill always break theLexerEditorHighlighter, but I don’t think, so since theGroovyLexerinintellij-communityreturns it, but it may be the case that it isn’t actually returned ever when users are typing and only handled by the lexer for completeness. Installation Instructions
Read next Understanding the Tradeoffs with Elixir Typespecs and Dialyzer
