Commit Graph
2519 Commits
Author SHA1 Message Date
Waldemar Rachwał e3d2dacff0 Two fixes in record/1 (#5412)
* Document use of `record/1` with atom argument.

* In `record/1` used with record argument, raise ArgumentError on record size mismatch.
2016-11-08 15:27:46 +01:00
José Valim 35f492b746 Allow "super" types in Calendar functions 2016-11-08 11:52:03 +01:00
Michał Muskała aebced19ec Simplify Kernel.match?/2 (#5429)
There's no need for a special handling of the underscore as the pattern,
the case expression is able of optimizing such cases too.

Additionally the right was never evaluated with underscore as the
pattern, which could lead to subtle bugs.

Currently match?(_, foo) will emit a pattern warning since both branches
of the case are exactly the same. This means such expressions had to be
removed from the test suite. They were replaced with the equivalent:

    fn _ -> true end
2016-11-08 01:07:09 +01:00
Michał Muskała 0aa8f16077 Make tokenizer recognize VC merge conflict marker (#5416)
The "<<<<<<<" is used by all major VC systems including git,
subversion and mercurial.
2016-11-06 17:55:59 +01:00
Joao Bernardo ecd3df624c Implements Date.day_of_week/1 (#5404) 2016-11-03 15:32:59 +01:00
Michał Muskała e24b7c6659 Use Macro.to_string/1 when printing bad struct keys (#5403) 2016-11-03 12:25:18 +01:00
Muaaz Saleem 40ff544ba7 Fixing :count support in OptionParser.to_argv (#5394) 2016-11-02 11:46:29 +01:00
José Valim 35a793dfe6 Add Registry 2016-11-02 10:11:51 +01:00
José Valim 1a2f278400 Introduce Task.async_stream/3 and Task.async_stream/5 (#5367) 2016-10-31 22:23:41 +01:00
Eksperimental 17fa3454b0 Spell "builtin" as "built-in" (#5376) 2016-10-29 16:19:24 +02:00
José Valim 5036439e95 Ensure we check for microseconds in Time.compare 2016-10-28 21:15:31 +02:00
Eksperimental 8a7989f894 Improve Typespecs page and test every document type (#5362) 2016-10-28 21:11:09 +02:00
Eksperimental 33bb6f3d14 Properly spell UTF-8 (#5373) 2016-10-28 21:09:23 +02:00
Eksperimental 4e0cb3e903 Remove spaces around * in bit syntax in Macro.to_string/2 (#5370)
Per discussion in https://github.com/elixir-lang/elixir/pull/5362#discussion_r85313529.
2016-10-28 16:10:17 +02:00
Aleksei Magusev b6251516d0 Improve names of String tests 2016-10-27 18:46:46 +02:00
José Valim 8505463431 Ensure both inner and outer transform streams are closed 2016-10-27 18:30:59 +02:00
José Valim de3873ff34 Refactor Task tests to use describe/2 2016-10-27 17:01:00 +02:00
Aleksei Magusev 6099c40e7c Generalize and move myers_difference/2 to List 2016-10-26 16:03:04 +02:00
Aleksei Magusev 619a32a2bd Favor struct update over Map.put/3 in Calendar tests 2016-10-25 20:50:53 +02:00
Aleksei Magusev 382d11fe12 Improve varible names in NaiveDateTime tests 2016-10-25 20:50:53 +02:00
Aleksei Magusev 6f627300a5 Use sigils in {Date, DateTime, NaiveDateTime}.compare/2 tests 2016-10-25 20:50:53 +02:00
Aleksei Magusev 4cfd562259 Put expected result on right side of assertion in Calendar tests 2016-10-25 20:50:53 +02:00
Otto Lin 989553d7bf Add Date/Time/NaiveDateTime.compare/2 (#5349) 2016-10-24 08:55:44 +02:00
José Valim f0b84922d9 Ensure we consistently wrap variables in quotes 2016-10-22 22:25:18 +02:00
Aleksei Magusev 582e8be0c1 Restructure doc samples in DocsTest 2016-10-22 21:12:09 +02:00
Aleksei Magusev 50a4831a82 Test all available doc kinds in the test for Code.get_docs/2 2016-10-22 20:53:37 +02:00
Aleksei Magusev c3ae2a4efa Fully validate the shape of the options for import/2 2016-10-22 20:53:34 +02:00
Aleksei Magusev 1e0d26d139 Favor ==/2 operator over match in assertions 2016-10-22 20:50:19 +02:00
Aleksei Magusev 35a4ecbb69 Make actual testing of doc attributes instead of occasional matching 2016-10-22 20:50:19 +02:00
Eksperimental 20e835020a File.rmdir!/1: give a less confusing error message when directory is not empty (#5299) 2016-10-14 11:39:55 +02:00
Eksperimental 029e92b5c7 Enforce rule of only guards should start with "is_" (#5300) 2016-10-13 10:05:38 +02:00
Eksperimental aa030d22cd Reword "pseudo-variables" with "compilation environment macros" (#5308)
As discussed in https://github.com/elixir-lang/elixir/pull/5301#pullrequestreview-3711427.
2016-10-12 00:49:47 +02:00
Aleksei Magusev 1e75af0046 Add test for unused var warning when defined inside case/2 (and similar)
819d81c28e commit has brought this warning and fixed #5024 issue.
2016-10-10 23:39:24 +02:00
Aleksei Magusev a1e5ab1c4f Enhance Dialyzer test for and/2 and or/2 expansion 2016-10-09 16:49:15 +02:00
Aleksei Magusev 41789b186a Suppress unused variable warning in Kernel.FnTest 2016-10-09 12:40:32 +02:00
Aleksei Magusev 2969eca83f Simplify assertion formatting in Kernel.FnTest 2016-10-09 12:38:34 +02:00
Aleksei Magusev 0554391852 Merge pull request #5295 from lexmag/new-and
Compile or/2 and and/2 to case/2 when in non-guard context
2016-10-09 11:02:31 +02:00
Aleksei Magusev cbe86c9b83 Add Dialyzer test for and/2 and or/2 expansion 2016-10-08 23:38:23 +02:00
Aleksei Magusev d4d546bf6a Add test for variable usage during in/2 expansion 2016-10-08 22:54:19 +02:00
José Valim c19ed9f910 Introduce Float.ratio/1 and fix Float.{ceil/2, floor/2, round/2}
The previous implementations for ceil, floor and round were
not formalized and were likely prone to multiple roundings
as we performed multiplication and division by a power of
10 on the given float.

The new implementation correctly converts the float to an
exact integer representation and perform all operations using
arbitrary precision integers. The only float operation occurs
when converting the ratio back to a float.

The current implementation is more expensive due to its reliance
on big integers. Faster implementations are available in literature
where the latest one seems to be Errol:

  https://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf

This change also introduces Float.ratio/1 which receives a
float and returns a pair of integers whose ratio is exactly equal
to the original float and with a positive denominator.

Closes #3400
2016-10-07 18:46:33 +02:00
Aleksei Magusev 9d67a0262b Expand in/2 test samples only once 2016-10-07 01:29:20 +02:00
Ben Olive 181450530a Implement Stream.zip/1 and Enum.zip/1 (#5289) 2016-10-04 16:12:07 +02:00
Magnus Lång 8bd6c17a6b Fix Dialyzer warnings on opaque protocol calls (#5286)
Prior to this change, calling a protocol function with an opaque type
would yield a warning, as Dialyzer concludes that the impl_for/1
function can't handle opaque arguments, since all clauses would
destructure their arguments in some way.

By adding a catch-all clause that does not destructure its argument,
Dialyzer no longer draws this conclusion, and the warnings go away.

As noted in the protocol.ex comment, this is technically a hack as it
relies on Dialyzer not being smart enough. However, I would not expect
it to break soon, if ever.
2016-10-04 14:17:11 +02:00
Michał Muskała 5054a26145 Fix Macro.to_string when printing keywords (#5270)
It was incorrect when given a literal atom resembling an alias.

Fixes #5268
2016-09-29 10:48:01 +02:00
James Fish 662ecf9be7 Fix Task.shutdown/1,2 infinite block when no monitor (#5252)
If the monitor no longer exists Task.shutdown/2 would block forever
waiting for it. Always setup new monitor and try to get the right down
result.
2016-09-25 19:13:44 +01:00
Aleksei Magusev 25e51bb498 Add extra test for string concatenation as match usage
This case has been fixed in 78c7ddc03f.
2016-09-25 01:44:20 +02:00
Alexei Sholik cf8f7c96a2 Use singular names for time units, as in Erlang/OTP 19.1. Fix #5236 (#5244) 2016-09-22 23:28:13 +03:00
Aleksei Magusev 9cd972dbde Remove unnecessary whitespaces in "colors" test for IO.ANSI 2016-09-21 23:41:00 +02:00
José Valim 8e2a1e5851 Remove Kernel.rand/0 and Kernel.rand/1
Since Enum.random/1 already provides the Kernel.rand/1
functionality.
2016-09-21 23:39:33 +02:00
James Fish 357bb4f914 Update dialyzer tests for OTP-19.1/dialyzer-3.0.2 2016-09-21 15:31:46 +01:00