Commit Graph
770 Commits
Author SHA1 Message Date
Gal Tsubery 9d8ae7d287 Validate options for comprehension (#5907)
This change raises error when invalid keys are give to "for" loops and
prevents silent errors.
2017-03-21 19:41:08 +01:00
Eksperimental 7357f56526 Add nonempty_charlist/0 built-in type (#5879) 2017-03-16 09:46:19 +01:00
José Valim ba24a2fef8 Inline binaries inside interpolation 2017-03-05 18:10:11 +01:00
Aleksei Magusev b10543cd20 Use correct file and module names for charlist tests 2017-02-25 19:01:15 +01:00
José Valim 3625f0d8be Keep ?var_context per module to avoid chance of conflicts 2017-02-24 01:29:44 +01:00
José Valim 5d6961fd92 Check for float size on elixir_bitstring 2017-02-24 00:29:01 +01:00
José Valim 4e0b33a43a Check for binary size in bitstring matches 2017-02-24 00:29:01 +01:00
José Valim 99892760de Split bitstring logic into proper modules 2017-02-23 23:53:12 +01:00
José Valim d84eadb45f Improve checking of bitstrings 2017-02-23 22:55:35 +01:00
José Valim 102a8a3fa8 Add elixir_erl_compiler 2017-02-23 13:15:26 +01:00
José Valim 2eb8490f9a Add prematch_vars 2017-02-23 10:43:09 +01:00
Aleksei Magusev 403e690593 Fix var context in Kernel.ExpansionTest 2017-02-21 21:08:51 +01:00
José Valim 300acb518e Deprecate parens as nil and support guards on funs with zero arity
Closes #5799
2017-02-21 13:06:43 +01:00
Aleksei Magusev a19f7a99bd Remove unnecessary :location cleaning in Kernel.ExpansionTest 2017-02-21 00:06:34 +01:00
Andrea Leopardi 03a16c7496 Unify formatting of some common expansion errors (#5797) 2017-02-20 17:04:33 +01:00
Andrea Leopardi c775ab6db2 Replace elixir_errors:compile_error/4 with form_error/4 in elixir_map 2017-02-20 13:24:24 +01:00
Andrea Leopardi 46d7ff9902 Unify the error we raise when cond/case/etc don't receive clauses (#5796)
Before this, we raised one error if we passed a list with some non-clauses in
it, and a different error if we passed a non-list.
2017-02-20 11:54:23 +01:00
José Valim 49ddf3736e Move more from elixir_module to elixir_erl 2017-02-20 01:35:02 +01:00
Andrea Leopardi 0ff4f20bbc Add tests for option handling in case/cond/try/receive 2017-02-20 00:45:31 +01:00
Andrea Leopardi 39c7115bc8 Replace elixir_errors:compile_error/4 with form_error/4 in elixir_with 2017-02-19 22:50:31 +01:00
Andrea Leopardi 9869361a8c Fix option validation in "with"
Before this commit, we were not validating unexpected options passed to "with"
if the "else" option was not present, because we were only checking for unknown
options in the code that checked for "else". This commit fixes this by checking
for unknown option after having handled "do" and "else".
2017-02-19 22:46:25 +01:00
Andrea Leopardi 36abf99274 Make the error for local calls in matches/guards uniform (#5794)
The error for local calls in matches was showing the call, but the one for local
calls in guards wasn't.
2017-02-19 22:06:27 +01:00
Aleksei Magusev 84b67b5b95 Rename elixir_exp module to elixir_expand 2017-02-19 21:57:50 +01:00
José Valim f56812acb7 Start moving files to elixir_erl 2017-02-19 19:40:21 +01:00
Andrea Leopardi f887316b26 Move many expansion errors tests from errors_test to expansion_test (#5792)
I also added a few missing tests that cover errors that happen during expansion.
2017-02-19 18:43:08 +01:00
José Valim b8b259cc5a Store meta per clause 2017-02-19 18:30:31 +01:00
José Valim 8e2ebf739b Split erl and ex passes in elixir_def 2017-02-19 13:01:13 +01:00
Andrea Leopardi 5b6cb55185 Correctly inspect options for "quote" when an error happens (#5791) 2017-02-19 12:08:19 +01:00
Aleksei Magusev bfb2035504 Raise CompileError on empty :else option in "with" 2017-02-19 00:52:27 +01:00
Aleksei Magusev c4b16009f5 Get rid of the need for "with" translation (#5790) 2017-02-19 00:31:58 +01:00
Andrea Leopardi 1cf41aeae8 Validate type for literal binaries in <<>> during expansion (#5786) 2017-02-18 11:58:36 +01:00
Andrea Leopardi d814555c34 Raise for invalid literals in <<>> during expansion (#5785) 2017-02-18 10:51:51 +01:00
Andrea Leopardi 604c24dd2e Raise for size() with literal binaries in <<>> during expansion (#5783) 2017-02-17 23:16:42 +01:00
José Valim 152cf2616b Move case inlining out of Elixir pass 2017-02-16 18:24:25 +01:00
José Valim ad7642b7d6 Perform map_key check on elixir_exp 2017-02-15 20:44:06 +01:00
Andrea Leopardi f50a7693f4 Remove some rescue-related errors from elixir_translator (#5776)
I also added tests for such errors in Kernel.ExpansionTest.
2017-02-15 19:40:44 +01:00
Andrea Leopardi 3094471dc5 Move "unbound variable ^foo" to elixir_exp (#5774) 2017-02-15 17:34:03 +01:00
José Valim 4728c562db Move &1 check to expansion pass 2017-02-15 17:07:07 +01:00
Kelvin Stinghen 386698aac3 Improving the function header def args compilation error (#5765)
The code:

    def f (x), do: x

was printing the function header definition error because it is parsed
to this:

    def f((x), do: x)

So we made an additional description to the compilation error.

This commit fixes #5761
2017-02-15 17:06:53 +01:00
Andrea Leopardi 5138a4453f Check for "unbound variable _" in elixir_exp (#5773)
I also had to adjust the check for "_ -> ..." clauses in "cond" because right
now, it performs such check after expanding the clauses, but with the change in
this commit then the "unbound variable _" error would fire first. With this
commit, we check for "_ -> ..." clauses before expanding the clauses, which may
not be ideal since the clauses could expand to "_ -> ..." but it's a compromise
we're willing to make (after all, this error is just a friendlier error than
"unbound variable _", not a necessary one).
2017-02-15 12:00:23 +01:00
Andrea Leopardi 9eff4ba103 Drop support for "rescue exception in _" (#5771)
We never officially supported this, but "accidentally" supported it because of
how we implemented "rescue exception" (without "in"). With this commit, we move
this step from expansion to elixir_try.
2017-02-14 20:25:23 +01:00
José Valim bb091b0b9a Move CompileAssertionFail to errors_test exclusively 2017-02-14 16:49:46 +01:00
José Valim a06561b8b5 Move expansion related tests to expansions_test 2017-02-14 15:41:08 +01:00
José Valim ddffa75cfe Move maps/structs validation to elixir pass 2017-02-14 14:34:22 +01:00
Andrea Leopardi 9dc579672e Move compile error for _ in cond to elixir_exp (#5767) 2017-02-14 11:32:07 +01:00
Andrea Leopardi 57211ef25a Move local-calls compile errors from elixir_translator to elixir_exp (#5764) 2017-02-14 00:22:53 +01:00
José Valim 9c0d6a66d5 Assert valid match and guard constructs on Elixir pass 2017-02-08 15:58:34 +01:00
José Valim a50630ea29 Remove translation from elixir_fn 2017-02-08 14:59:11 +01:00
Gal Tsubery 1341bdff9e Fix redefined function source location (#5720)
When functions are redefined in a different file, the translation uses
the first definition source location for all subsequent definitions.
This manifests itself as warnings that are ascribed to the wrong file.

Fixes #5719
2017-01-31 11:05:27 +01:00
José Valim 15cc965a0c Remove outdated super test 2017-01-24 14:34:26 +01:00