Commit Graph
5279 Commits
Author SHA1 Message Date
Andrea Leopardi 7a2e04b800 Add @specs to Enum.reduce_while/3
Closes #4890.

I also reworded the docs for this function.
2016-06-26 09:56:51 +02:00
Victor Rodrigues 6237ffdc2c Fix documentation for Date.new/3 (#4888) 2016-06-26 01:02:07 +02:00
Aleksei Magusev 28f6fecf5c Simplify argument name definition in Calendar.to_string/1 callback 2016-06-26 00:52:14 +02:00
Andrea Leopardi 680746756a Improve an assertion in MacroTest
We were only asserting that some code raised an error (ArgumentError),
but we weren't asserting on the message, thus making the test's context
hard to grasp. I added the error message in the assertion and reworded
the test name a bit.
2016-06-25 14:37:37 +02:00
Eksperimental 9257fd83c1 Properly spell PID (#4883) 2016-06-25 09:03:35 +02:00
Eksperimental f9b8fb58bb Spell properly BEAM (#4882) 2016-06-25 09:03:15 +02:00
David Whitlock 1a71e0e9db Remove unused import in kernel/overridable_test.exs (#4884) 2016-06-25 05:49:12 +02:00
Eksperimental 2e97c1e15e Name variables in callbacks (#4880) 2016-06-25 04:08:43 +02:00
José Valim a701f1f8cc Deprecate import_file/2 2016-06-25 00:54:55 +02:00
Andrea Leopardi a658afc12b Deprecate support for making private functions overridable (#4872)
We already don't support private macros so not supporting private
functions anymore seems reasonable.
2016-06-25 00:39:18 +02:00
Benjamin Falk 2a0787d11d Generate error for no pid given to Genserver.reply (#4876)
Prior to this change it is possible to send any two-pair tuple to
`GenServer.reply/2` and it will happily return `:ok`, catching any
errors.  This leads to some hard to track-down bugs if you pass
it the wrong term.
2016-06-24 23:07:09 +01:00
Aleksei Magusev ee07c7fb51 Validate application properties before altering them
Closes #4873.
2016-06-24 17:08:20 +02:00
Aleksei Magusev c68c2e41f8 Fix Kernel.LexicalTracker not to discard alias directives on import
Closes #4871.
2016-06-24 13:14:41 +02:00
Andrea Leopardi 82fa7051b5 Raise an ArgumentError when overriding an undefined function (#4870)
I also added a test for this behaviour as there was none.
2016-06-24 08:17:23 +02:00
Eksperimental 1ecaae6b14 Enum.take_random/2: Update docs and optipmize (#4869) 2016-06-24 00:37:42 +02:00
Andrea Leopardi f9d82b416c Raise an error when trying to make private macros overridable (#4856)
This is not supported as of today because of bugs regarding defoverride
and macros, but we decided to not support overriding private macros at
all so let's raise a nice error message.

For the record, supporting overridable private macros would be very
annoying since we rely on function names and the such for implementing
overridable stuff, and for private macros we just generate functions on
the fly.
2016-06-24 00:21:25 +02:00
Eksperimental e2bc83bab8 Add missing backquote in Module docs (#4866) 2016-06-23 23:44:22 +02:00
Eksperimental 8a3a9729d7 String.splitter/3: add doctest example (#4867) 2016-06-23 23:25:33 +02:00
Eric Entin 0bf123cf10 Skip/fix tests on OTP 19 (#4855)
* Callback-related tests use beam AST to find callbacks

* Fix invalid function call warning on OTP 19

* Skip dialyzer-related tests on OTP 19

* Fix IEx h helper for OTP 19

* Improve IEx h helper test for multi-arity callbacks
2016-06-23 10:09:16 +02:00
Andrea Leopardi 2e1953ce97 Refactor an assertion in Kernel.OverridableTest
This test was using an arcane dance to assert that some code would raise
an exception (with try/rescue, flunk, and so on) and using
:elixir.eval/2 as well; these remains of ancient times have been
replaced with Code.eval_string/1 and assert_raise/3 for more modern
Elixir code.
2016-06-23 00:25:49 +02:00
Marcus Gartner ed23a498fb Clarify Enum.group_by/3 deprecation message (#4852) 2016-06-22 19:01:25 +02:00
José Valim dfaf42b01e Move TODO to Erlang 19 umbrella issue #4617 2016-06-22 18:08:14 +02:00
Aleksei Magusev 473217cc26 Simplify function kind check in elixir_def_overridable.erl 2016-06-22 13:11:43 +02:00
Andrea Leopardi ab46e5fde3 Support macros with defoverridable/super (#4848) 2016-06-22 11:40:24 +02:00
José Valim 8d4bbb4886 Explicitly announce structs
Before this patch, we could announce a struct too early,
only when __struct__/0 was defined (and not __struct__/1)
leading to deadlocks in the compiler. We fixed the bug and
made struct announcements to avoid future bugs.

Closes #4844
2016-06-22 10:05:01 +02:00
Daniel Perez c9b87d3c8f Improve with/else error message on invalid form (#4847) 2016-06-22 09:30:54 +02:00
José Valim f64fd54167 Do not expect stacktraces to be always present, closes #4840 2016-06-21 20:26:46 +02:00
José Valim 029d416677 Improve docs around Grapheme Cluster 2016-06-21 10:11:57 +02:00
Eric Entin 085e789912 Improve lexical tracker test (#4835) 2016-06-20 22:36:25 +02:00
Aleksei Magusev 42a5adf1f2 Suppress warnings in Map doctest 2016-06-20 20:24:08 +02:00
Andrea Leopardi 9739e83786 Add docs for the "set" datatype in the MapSet module (#4825) 2016-06-18 01:01:00 +02:00
Myron Marston 80d2c37e98 Clarify some confusing docs for the === operator (#4823)
The Erlang docs[1] describe the equivalent `=:=` operator as
"Exactly equal to", so I think "exact equality operator" is a
better name for this.

[1] http://erlang.org/doc/reference_manual/expressions.html#id80318
2016-06-18 01:00:48 +02:00
Andrea Leopardi 579d864dba Add docs for the "tuple" data type to the Tuple module (#4821) 2016-06-17 01:13:55 +02:00
Andrea Leopardi eddfb37e79 Document the "map" data type in the Map module (#4820) 2016-06-17 01:11:14 +02:00
Andrea Leopardi 8ac5d26def Remove some trailing whitespace in the List module
[ci skip]
2016-06-17 00:24:28 +02:00
José Valim e7520e5a91 Expose schedulers_online and otp_release information 2016-06-16 23:52:42 +02:00
José Valim 0d0c38a79d Mention improper lists too 2016-06-16 19:58:54 +02:00
José Valim c70764837f Improve the docs for lists 2016-06-16 19:47:39 +02:00
Eugene Pirogov ddb5b0c484 Add more is_function/2 guards to functions in Enum (#4817) 2016-06-15 23:23:50 +02:00
Pedro Medeiros ff5a0cc72f Simplify code to remove warning: unsafe in 'case' (#4816) 2016-06-15 18:41:01 +02:00
Andrea Leopardi e8c3882862 Merge pull request #4802 from whatyouhide/better-maps
Some improvements to the Map module
2016-06-15 16:37:24 +02:00
José Valim c6aad4518f Ensure variables in function clauses are not reused, closes #4815
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2016-06-15 16:14:48 +02:00
José Valim 8c940cc550 Remove elixir_counter in favor of unique_integer
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2016-06-15 15:25:28 +02:00
José Valim 7e6d428cac Ensure entries are sorted to avoid non-determinism in compilation, closes #4814
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2016-06-15 15:25:24 +02:00
robi-wan 47de3a704b Fix failing Kernel.DialyzerTest under Windows (#4805)
Under Windows (7 Pro, 64 bit) the Kernel.DialyzerTest fails:

  1) Kernel.DialyzerTest: failure on setup_all callback, tests invalidated
     ** (ErlangError) erlang error: {:dialyzer_error, 'The HOME environment variable needs to be set so that Dialyzer knows where to find the default PLT'}
     stacktrace:
       dialyzer.erl:173: :dialyzer.run/1
       lib/elixir/test/elixir/kernel/dialyzer_test.exs:21: Kernel.DialyzerTest.__ex_unit_setup_all_0/1
       lib/elixir/test/elixir/kernel/dialyzer_test.exs:3: Kernel.DialyzerTest.__ex_unit__/2

Actually this is an erlang error: dialyzer expects the environment variable HOME set.
But Windows does not have this environment variable available.
(It has HOMEDRIVE and HOMEPATH.)

This commit makes the DialyzerTest pass by setting the HOME environment variable (when necessary).

Using System.user_home to set the HOME env var works because System.user_home uses `:elixir_config.get(:home)`.
`elixir_config` gets the value of `:home` from `init:get_argument(home)` (see file `lib\elixir\src\elixir.erl`)
And - finally - erlang honors these environment variables when computing `home`
(see https://github.com/erlang/otp/blob/maint/erts/etc/common/erlexec.c#L1548-L1549).

Erlang sometimes uses `os:getenv("HOME")` and sometimes `init:get_argument(home)` to get the home directory of the user.
2016-06-14 08:45:41 +02:00
robi-wan af48c58c9b Fix failing SigilsTest for newline under Windows (#4806)
* SigilsTest fails for newline under Windows

  1) test sigil S (Kernel.SigilsTest)
     lib/elixir/test/elixir/kernel/sigils_test.exs:18
     Assertion with == failed
     code: ~S"foo\\\r\nbar" == "foo\\\nbar"
     lhs:  "foo\\\r\nbar"
     rhs:  "foo\\\nbar"
     stacktrace:
       lib/elixir/test/elixir/kernel/sigils_test.exs:32: (test)

[Newlines](https://en.wikipedia.org/wiki/Newline).

[Github](https://help.github.com/articles/dealing-with-line-endings/#platform-windows)
recommends setting `core.autocrlf true` on Windows for cross-platform projects.

[Git documentation](https://git-scm.com/book/tr/v2/Customizing-Git-Git-Configuration#Formatting-and-Whitespace)
also recommends this setting on Windows.

Using this setting let the SigilsTest fail because the sigil contains a newline which is `\r\n` under Windows and not `\n`.

Use os dependent tests for newline.

* Remove unnecessary new lines
2016-06-14 08:45:00 +02:00
Eric Entin 82dd9ad277 Make sure struct expansion results in a remote dispatch (#4807) 2016-06-12 23:38:51 +02:00
Aleksei Magusev c9cb49350e Make sure with/1 does not leak variables to else (#4804) 2016-06-12 21:26:06 +02:00
Eric Entin 8467383aef Improve Kernel.LexicalTracker module docs (#4803) 2016-06-12 19:58:11 +02:00
José Valim 856db3b93a Disable relative paths when loading mix.exs, closes #4465 2016-06-12 18:55:00 +02:00