Commit Graph
2047 Commits
Author SHA1 Message Date
Aleksei Magusev 17b3df271d Fix bitstring splicing for bytes type modifier 2015-10-07 00:30:41 +02:00
Eric Meadows-Jönsson 4bbd3b0bbb inspect invalid ANSI sequences 2015-10-05 17:34:15 -05:00
José Valim 40fff43ea0 Merge pull request #3832 from ma2gedev/macro-traverse
Add `Macro.traverse/4` pre/post-order traversal at the same time
2015-10-04 15:28:26 -05:00
Takayuki Matsubara 7e1073ec49 Add Macro.traverse/4 pre/post-order traversal at the same time
Almost is like the `Macro.prewalk/3` and `Macro.postwalk/3` but
pre/post-order traversal at the same time.
2015-10-05 00:06:21 +09:00
José Valim f6b2ddd81b Merge pull request #3805 from endersstocker/add-string-normalize-nfc
Add NFC support to String.normalize/2
2015-10-04 08:55:34 -05:00
Aleksei Magusev d682c47bf9 Omit else option in if and unless clauses if it returns nil 2015-10-03 21:07:19 +02:00
Bryan Endersstocker 07fedf66d0 Add NFC support to String.normalize/2 2015-10-03 11:08:55 -04:00
CrowdHailer f2cd34f1a8 use macro to show code sample in error message 2015-10-01 16:04:35 +01:00
José Valim c0c6983363 Print byte information on base decoding errors 2015-09-29 15:21:50 +02:00
José Valim f7654bf66a Ensure we print unicode codepoints on errors, closes #3804 2015-09-29 15:03:55 +02:00
José Valim ca89db448f Check Range creation at runtime 2015-09-28 09:49:31 +02:00
José Valim 77f2558cf5 Merge pull request #3786 from lexmag/no-spaces-range
Use same form for ranges in error messages what we use for `inspect/2`
2015-09-27 22:57:48 +02:00
José Valim 8f869ad471 Merge pull request #3784 from eksperimental/fix_macro_to_string_test
Macro.to_string/2 : add test
2015-09-27 22:57:04 +02:00
Aleksei Magusev 262edd2c25 Use same form for ranges in error messages what we use for inspect/2 2015-09-27 22:25:53 +02:00
Aleksei Magusev 99f0ed1915 Сurrently Kernel.struct!/2 raises only KeyError 2015-09-27 22:13:37 +02:00
eksperimental 84c2d76c05 Macro.to_string/2 : add test 2015-09-27 22:58:14 +07:00
eksperimental 31a30afafd Fix Range validation
- checks for lists when defining range
- replace (left .. right) with (first .. last) in error messages
  to use the same terminology used in the function definition
- add guards to Range.new/2
- add specs to Range.range?/1
- test added to check for lists in range.
2015-09-27 22:46:18 +07:00
eksperimental 0ce1c441d5 Fix Macro.to_string/2 to print ranges
this removes the spaces between the ranges and the periods
2015-09-27 18:53:05 +07:00
José Valim b8c664c739 Merge pull request #3767 from endersstocker/add-string-is-equivalent
Add String.equivalent?/2 to test canonical Unicode equivalence
2015-09-26 17:55:19 +02:00
Bryan Endersstocker bf02047280 Add String.normalize/2 2015-09-26 00:12:44 -04:00
Bryan Enders dab2a632b6 Rename String.is_equivalent/2 to String.equivalent?/2 2015-09-25 15:01:29 -04:00
José Valim e3560a8763 Bring unused warnings into tests 2015-09-25 19:42:56 +02:00
Bryan Enders f83cc7de5f Add String.is_equivalent/2 to test canonical Unicode equivalence 2015-09-25 13:35:16 -04:00
José Valim ff51926fe8 Move away from HashDict and HashSet 2015-09-25 12:46:22 +02:00
José Valim 0e5804fdbf Merge pull request #3666 from lexmag/import-many-friends
Introduce support for Mod.{A, B, C} on imports, alias, require and use
2015-09-25 12:02:30 +02:00
José Valim 3bd0528ba5 Merge pull request #3738 from lexmag/raising-struct
Add raising on unknown keys version of `Kernel.struct/2`
2015-09-25 12:02:01 +02:00
José Valim f524f25c58 Require Erlang 18.0 forward 2015-09-25 12:01:10 +02:00
Aleksei Magusev 8a657eb4b2 Add raising on unknown keys version of Kernel.struct/2 2015-09-25 11:57:30 +02:00
Aleksei Magusev 8c57c91103 Consider multi-alias call on use 2015-09-25 11:53:54 +02:00
Aleksei Magusev e57db36501 Consider multi-alias call on import, alias, require 2015-09-25 11:53:54 +02:00
Aleksei Magusev a54d9034f1 Add test for use macro 2015-09-25 11:53:54 +02:00
José Valim dcf8df3629 Raise if arity not in 0..255, closes #3754 2015-09-23 14:17:51 +02:00
José Valim 38f716c4eb Ensure suspending flat map does not consume items, closes #3751 2015-09-23 14:04:32 +02:00
Aleksei Magusev ac9a9abf8f Raise CompileError in case of duplicated do clauses for case 2015-09-21 22:59:20 +02:00
Aleksei Magusev b1fec938e9 Raise CompileError in case of duplicated do clauses for cond 2015-09-21 22:58:47 +02:00
Aleksei Magusev c9a3cfae88 Raise CompileError in case of duplicated clauses given for receive 2015-09-21 22:51:37 +02:00
Aleksei Magusev 9726dad3ab Raise CompileError in case of duplicated clauses given for try 2015-09-21 22:41:08 +02:00
José Valim e75a675fd5 Add missing after callback in Stream.transform 2015-09-18 20:24:16 +02:00
José Valim 62baed24a8 Default to universal times throughout File 2015-09-14 14:28:29 +02:00
José Valim 6cb17c55ea Merge pull request #3659 from stevedomin/process-info-spec-list
Allow list of spec in Process.info/2
2015-09-13 13:13:14 +02:00
José Valim f19b83df50 Merge pull request #3684 from redpine50/master
made Float.parse() support complete scientific notation
2015-09-13 12:49:19 +02:00
José Valim a0e1f16c48 Ensure File.touch and File.touch! properly work with universal time
Operations that change mtime should work with universal times.

Closes #3722.
2015-09-11 23:45:47 +02:00
eksperimental ed5671b4f8 Standardize use of backticks and quotes; including Error messages and Title Case commands
This is a large commit that does the following:
* Removes backticks from messages and comments.
  All references to backticks have been replaced with double quotes everywhere the
  code is not interpreted as Markdown, (ie. anywhere outside documentation and
  markdown files, such as in code comments, or error messages).

* Variables in Exception messages are printed using `inspect`
  The way no-matching error message are printed, have changed because now we use inspect for printing
  variables. The following file and their respective test have been changed:
  - lib/elixir/lib/exception.ex
  - lib/elixir/lib/inspect/algebra.ex
  - lib/elixir/test/elixir/inspect_test.exs
  - lib/ex_unit/test/ex_unit/formatter_test.exs
  - lib/elixir/test/elixir/exception_test.exs

* Properly use Title Case for Mix, Git, Dializer

* Use backticks when citing a command

****************************************************
CONVENTION FOR RENAMING USING BACKTICKS AND QUOTES

https://github.com/elixir-lang/elixir/pull/3697#issuecomment-138811747

1. Backticks should never be printed in error messages, neither be included anywhere where Markdown code is not interpreted as such.

2. Do not use single quotes anywhere. We should favor double quotes everywhere, to avoid confusion

3. If you want to format something in error messages, use inspect. For example, if you want to show the dependency name and that is an atom, instead of the dependency "foo", let's show the dependency :foo. Less noise and may click better

4. Similarly, if you want to show something with double quotes, call inspect, as it handles escaping as well as the quotes

5. Things like "--all" just add verbosity, we can definitely read --all without ambiguity.

6. When using switches with a single hyphen (such as "-o"), we can make it explicit in the text: e.g. "... give the switch -o when choosing ..."

****************************************************
SHELL COMMANDS TO DETECT CODE BREAKING THE RULES

* Detect values surrounded by single-quotes where we want double-quotes.

    # regular variables
    ag "'#{"
    # constants or ENV variables
    ag "'[A-Z][A-Z0-9_-]+"
    # switches
    ag -i "(?<!(\[))'--?[a-z0-9][a-z0-9_-]+'"
    # atoms
    ag -i "(?<!(\[))':[a-z0-9][a-z0-9_-]+'"

    # DETECT BACKTICKS OUTSIDE DOCS
    ag "^\s+(?<!(#))#[^#\r\n]*\`" --ignore "*.md"
    ag '^\s+["%].*`' --ignore "*.md"
    ag -s '(raise|Error)\b(?!(`|/)).*\`'

* Spot mentions to running a command that is not using backticks:

    commands="elixir|elixirc|mix|iex|ex_doc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    actions="runs?|running|executes?|executing|types?|typing|enters?|entering|calls?|calling"
    ag '(?i)('${actions}')(?-i)\b[^`\r\n/]+[\ \t]+(?!(`))('${commands}')'
    ag '(?-i)\b(?!(`))('${commands}')[\ \t]+[^`\r\n/]+(?i)(commands?)'

* Spot where a command is mentioned:

    #commands="erlang|elixir|eex|iex|ex_unit|ex_doc|logger|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    commands="mix|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    ag -s '(?<!(\`))(?<!(\.))(?<!(/))(?<!(:))(?<!(_))\b('${commands}')\b(?!(:))(?!(\?))(?!(_))(?!(-))(?!(\.))(?!(\`))(?!(/))(?!(>))' \
    --ignore "*.erl" --ignore "*.yrl" --ignore "*.src"
2015-09-11 18:49:51 +07:00
José Valim f6a681c3eb Ensure binding() doesn't warn on underscored vars, closes #3708 2015-09-11 11:25:27 +02:00
redpine50 87683efe57 New test cases for exponent marker E and leading + 2015-09-09 23:52:36 +10:00
eksperimental 7b2fa9192a Use Title Case and backticks for Erlang and Elixir applications
It includes Erlang, Elixir, ExUnit, ExDoc, Logger, IEx, elixirc

It leaves Mix for a different PR.

Command to spot these words:

    ag -s '(?<!(\`))(?<!(\.))(?<!(/))(?<!(:))(?<!(_))(erlang|elixir|eex|iex|ex_unit|ex_doc|logger|elixirc)(?!(:))(?!(\?))(?!(_))(?!(-))(?!(\.))(?!(\`))(?!(/))(?!(>))' \
    --ignore "*.erl" --ignore "*.yrl" --ignore "*.src"
2015-09-09 01:51:22 +07:00
Steve Domin 0a33de6067 Allow list of spec in Process.info/2 2015-09-08 01:10:04 +01:00
eksperimental c79d63f7c1 Correct spaces in iex>
It also removes the comment with doble ##,
So we can validate faulty indentation in iex>, ...>, ##  with command:

    # only 0, 2, 6, 10 spaces is valid for iex>, ...>, ##
    ag "^(\ {1}|\ {3,5}|\ {7,9}|\ {11,100})(iex>|\.\.\.>|##)" --ignore "*.sh" --ignore "*.md" --ignore "lib/ex_unit/test/ex_unit/doc_test_test.exs"
2015-09-07 23:28:30 +07:00
José Valim 4bb4e916fd Convert remaining test :atom to strings 2015-09-05 20:35:26 +02:00
aforward 5d7a7ec7f9 Add support for File.rename (unix-like mv) based on elrang specs 2015-09-05 08:09:13 -04:00