Commit Graph
1079 Commits
Author SHA1 Message Date
José Valim f7654bf66a Ensure we print unicode codepoints on errors, closes #3804 2015-09-29 15:03:55 +02:00
José Valim e3560a8763 Bring unused warnings into tests 2015-09-25 19:42:56 +02:00
José Valim 511cb5d3a5 Streamline more code specific to Erlang 18 2015-09-25 12:59:47 +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 f524f25c58 Require Erlang 18.0 forward 2015-09-25 12:01:10 +02:00
Aleksei Magusev e57db36501 Consider multi-alias call on import, alias, require 2015-09-25 11:53:54 +02:00
Aleksei Magusev a5a29dc47b Add support for x.{y, z, w} expression 2015-09-25 11:53:54 +02:00
José Valim 94c3f89e37 Ensure we list structs and requires as compile time deps 2015-09-24 12:35:53 +02:00
José Valim dcf8df3629 Raise if arity not in 0..255, closes #3754 2015-09-23 14:17:51 +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
Aleksei Magusev 136c036a82 compile_error/3,4 is already imported in elixir_exp_clauses 2015-09-21 19:28:37 +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
José Valim 25f451ec16 Ensure we don't warn on missing imports if nothing was imported
Closes #3625
2015-09-01 10:29:54 +02:00
José Valim c838bcd3cb Improve unexpected token error messages 2015-09-01 00:32:46 +02:00
José Valim ab00a502bc Forward all info values to get_module_info 2015-08-31 21:03:52 +02:00
José Valim dc78ac4423 Merge pull request #3600 from jisaacstone/lineno
Line numbers for doctest errors. Fixes issue #3592
2015-08-24 13:11:02 +02:00
José Valim 4bce6d063a Keep metadata when rewriting assertions 2015-08-24 00:19:00 +02:00
José Valim 9a0911a6a7 Handle warns coming from erlang with line set to :none 2015-08-21 16:31:49 +02:00
jisaacstone 2320097aa7 Line numbers for doctest errors. Fixes issue #3592
Note that this will change all line numbers retured by `Code.get_docs`.
2015-08-19 11:04:50 -07:00
José Valim 0536a7cd6d Keep proper line info in rewritten/inlined code
Related to #3444
2015-08-18 15:15:24 +02:00
José Valim 458bb2796d Clean up map access code 2015-08-18 10:20:04 +02:00
ꗈ ꘐ ꗈ b8ee8c3e73 Raise if heredic terminator in invalid location
issue #3503

This will raise:
```elixir
foo = """
this """
```

This will not:
```elixir
foo = """
this \"\"\"
"""
```
2015-08-17 12:08:38 -07:00
José Valim c2813ac1ea Also perform new line checking with structs 2015-08-16 20:47:53 +02:00
José Valim 970f84382b Allow operators to work still after comments
Closes #3316
2015-08-16 20:11:11 +02:00
José Valim 4f265b12d6 Also fail on do after , and ;
Closes #3293
2015-08-16 19:49:04 +02:00
José Valim 3327854653 Support \u in strings and char lists for unicode mapping 2015-08-16 18:32:29 +02:00
José Valim f718344071 Deprecate as: true | false in require/alias 2015-08-16 18:04:11 +02:00
José Valim 84830d37ef Deprecate ?\x in favor of simply 0x 2015-08-16 18:00:10 +02:00
José Valim 4c1cd147a5 Soft deprecate booleans in :as, closes #3190 2015-08-16 16:19:09 +02:00
José Valim aa43f3f281 Emit syntax error for invalid fn end, closes #3311 2015-08-16 15:30:20 +02:00
José Valim 1afb655191 Make a distinction between Location, Token and Node in parser 2015-08-15 14:14:11 +02:00
José Valim ac5c72dbc7 Soft-deprecate Behaviour 2015-08-14 23:01:37 +02:00
Eric Entin 7aba0e0b52 @callback can now be used directly (without Behaviour). Add @macrocallback. 2015-08-14 14:29:34 +01:00
James Fish 030a4fec31 Warn defaults not defined in function head with multiple clauses 2015-08-12 23:41:38 +01:00
José Valim aeea7799fa Use or in left in [a, b, c] as the compiler can opt it better 2015-08-12 11:46:32 +02:00
ꗈ ꘐ ꗈ add22f4b5b capture non-symbolic operators (&and/2, &not/1, &c.)
partial fix for issue #3486
pin operator  is a different issue and will take some more investgation to find the cause.
2015-08-11 11:25:26 -07:00
José Valim ed0aa20010 Fix var warnings 2015-08-11 19:05:57 +02:00
José Valim a887d84d8f Add useless building warnings for module attributes and variables 2015-08-11 15:41:36 +02:00
José Valim 98f53ae7e2 Handle optimizable returns explicitly 2015-08-11 15:41:36 +02:00
José Valim 859d176037 Warn when numbers or binaries are not used within a block 2015-08-11 15:41:36 +02:00
José Valim 1a74191013 Add = to list of functions that handle returns 2015-08-11 15:41:36 +02:00
José Valim ebff46615c Add @type struct and error when overriding builtins
Closes #2990
2015-08-11 11:44:24 +02:00
José Valim b3d74127cf Make a distinction between strict containers and strict calls 2015-08-01 08:25:52 +02:00
José Valim 80fd98f01a Streamline aliases and imports in lexical tracker
Aliases should not mark nodes as compile or runtime
since it receives the alias to be expanded. The
expanded alias is always called later though as a
remote dispatch.

Imports should always mark nodes as compile time,
since they are compile time dependencies.

Finally, ensure compile nodes have higher priority
over runtime ones.
2015-07-22 09:59:31 +02:00
José Valim 1fd72ba72f Reduce noise in lexical tracker output 2015-07-22 02:53:25 +02:00