|
4 | 4 | -export([syntax_error/3, syntax_error/4, inspect/1, |
5 | 5 | form_error/4, parse_error/4, assert_module_scope/3, |
6 | 6 | assert_no_function_scope/3, assert_function_scope/3, |
7 | | - assert_no_assign_scope/3, assert_no_guard_scope/3, |
8 | | - assert_no_assign_or_guard_scope/3, |
| 7 | + assert_no_match_scope/3, assert_no_guard_scope/3, |
| 8 | + assert_no_match_or_guard_scope/3, |
9 | 9 | handle_file_warning/2, handle_file_warning/3, handle_file_error/2, |
10 | 10 | deprecation/3, deprecation/4, file_format/3]). |
11 | 11 | -include("elixir.hrl"). |
@@ -97,15 +97,15 @@ handle_file_warning(_, _File, { _Line, v3_kernel, bad_call }) -> []; |
97 | 97 | %% Rewrite |
98 | 98 | handle_file_warning(_, File, {Line,erl_lint,{undefined_behaviour_func,{Fun,Arity},Module}}) -> |
99 | 99 | Kind = protocol_or_behaviour(Module), |
100 | | - Raw = "undefined ~s function ~s/~B (for ~s ~s)", |
| 100 | + Raw = "undefined ~ts function ~ts/~B (for ~ts ~ts)", |
101 | 101 | Message = io_lib:format(Raw, [Kind, Fun, Arity, Kind, inspect(Module)]), |
102 | 102 | io:format(file_format(Line, File, Message)); |
103 | 103 |
|
104 | 104 | handle_file_warning(_, File, {Line,erl_lint,{undefined_behaviour,Module}}) -> |
105 | 105 | case elixir_compiler:get_opt(internal) of |
106 | 106 | true -> []; |
107 | 107 | false -> |
108 | | - Message = io_lib:format("behaviour ~s undefined", [inspect(Module)]), |
| 108 | + Message = io_lib:format("behaviour ~ts undefined", [inspect(Module)]), |
109 | 109 | io:format(file_format(Line, File, Message)) |
110 | 110 | end; |
111 | 111 |
|
@@ -137,26 +137,26 @@ handle_file_error(File, {Line,Module,Desc}) -> |
137 | 137 |
|
138 | 138 | assert_no_function_scope(_Meta, _Kind, #elixir_scope{function=nil}) -> []; |
139 | 139 | assert_no_function_scope(Meta, Kind, S) -> |
140 | | - syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~s inside a function", [Kind]). |
| 140 | + syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~ts inside a function", [Kind]). |
141 | 141 |
|
142 | | -assert_no_assign_or_guard_scope(Meta, Kind, S) -> |
143 | | - assert_no_assign_scope(Meta, Kind, S), |
| 142 | +assert_no_match_or_guard_scope(Meta, Kind, S) -> |
| 143 | + assert_no_match_scope(Meta, Kind, S), |
144 | 144 | assert_no_guard_scope(Meta, Kind, S). |
145 | 145 |
|
146 | | -assert_no_assign_scope(Meta, Kind, #elixir_scope{context=assign} = S) -> |
147 | | - syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~s inside assign", [Kind]); |
148 | | -assert_no_assign_scope(_Meta, _Kind, _S) -> []. |
| 146 | +assert_no_match_scope(Meta, Kind, #elixir_scope{context=match} = S) -> |
| 147 | + syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~ts inside match clause", [Kind]); |
| 148 | +assert_no_match_scope(_Meta, _Kind, _S) -> []. |
149 | 149 |
|
150 | 150 | assert_no_guard_scope(Meta, Kind, #elixir_scope{context=guard} = S) -> |
151 | | - syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~s inside guard", [Kind]); |
| 151 | + syntax_error(Meta, S#elixir_scope.file, "cannot invoke ~ts inside guard", [Kind]); |
152 | 152 | assert_no_guard_scope(_Meta, _Kind, _S) -> []. |
153 | 153 |
|
154 | 154 | assert_module_scope(Meta, Kind, #elixir_scope{module=nil,file=File}) -> |
155 | | - syntax_error(Meta, File, "cannot invoke ~s outside module", [Kind]); |
| 155 | + syntax_error(Meta, File, "cannot invoke ~ts outside module", [Kind]); |
156 | 156 | assert_module_scope(_Meta, _Kind, #elixir_scope{module=Module}) -> Module. |
157 | 157 |
|
158 | 158 | assert_function_scope(Meta, Kind, #elixir_scope{function=nil,file=File}) -> |
159 | | - syntax_error(Meta, File, "cannot invoke ~s outside function", [Kind]); |
| 159 | + syntax_error(Meta, File, "cannot invoke ~ts outside function", [Kind]); |
160 | 160 | assert_function_scope(_Meta, _Kind, #elixir_scope{function=Function}) -> Function. |
161 | 161 |
|
162 | 162 | %% Helpers |
|
0 commit comments