Age | Commit message (Collapse) | Author |
|
Strengthen some specs that were a bit more liberal than they should.
While at it, change uses of the is_subtype guard to :: which is more
modern and compact.
|
|
|
|
* ks/export-types:
Export opaque types so as to be used by other modules
|
|
|
|
|
|
|
|
|
|
* pan/ms_transform_warnings/OTP-6759:
Add testcases for ms_transform warning and fix scoping
Add warnings for shadowed variables in ms_transform funs
|
|
Cleaned up and documented the public_key API to
make it useful for general use.
|
|
* pg/beam_lib_cmp_2_return_type_specification:
Fix beam_lib:cmp/2 return type specification
|
|
* cf/timer_tc:
Add timer:tc/2 to measure the elapsed time of anonymous functions
Conflicts:
lib/stdlib/doc/src/timer.xml
|
|
* ks/cleanups:
compiler: Fix incorrect types and specs
escript: Add more types to records
debugger: Clean up as suggested by tidier
docbuilder: Clean up as suggested by tidier
Conflicts:
lib/debugger/src/dbg_iload.erl
lib/debugger/src/dbg_ui_trace_win.erl
|
|
|
|
Also changed compiler to allow for warnings in parse_transforms.
|
|
Specify that beam_lib:cmp/2 can return {error, beam_lib, different_chunks} if a chunk is only present in one of the beams.
|
|
|
|
* pan/otp_8683_compiler_warnings:
Remove (harmless) warning regarding auto-imported BIF max/2
Update primary bootstrap
Correct warnings and errors for auto-imported bif clashes
Conflicts:
bootstrap/lib/stdlib/ebin/erl_lint.beam
|
|
warn_unused_import works correctly (does not give warnings when overridden).
Local call in guard gives its own error pointing out the local/imported
function.
Use of the phrase "overridden auto-imported bif" instead of "redefined
auto-imported bif" in textual error messages.
|
|
Change erl_lint not to recognize this type as builtin and
add a new erl_lint.beam version in bootstrap.
Add an -opaque type declaration for this type in ets.erl
and also declare this as an exported type. Use this type
in file debugger/src/dbg_iload.erl in a spec.
While at it, also clean up this later file a bit.
|
|
While at it, also do some cleanups.
|
|
In commit 1858cb81391d2bce29b4b7620574ca60128cebf7, erl_expand_records
started to optimize is_record/2 in guards by replacing it with
pattern matching (if possible).
Unfortunately, dialyzer will no longer see the code before the
optimization, so any warnings produced in code such as:
case ExprNotProducingRecord#rec{} of
X when is_record(X, rec, N) -> ...
will refer to the optimized code and not the source code,
which is confusing for the user.
Introduce the no_is_record_optimization option for turning off
the optimization and use it in dialyzer.
Reported-by: Kostis Sagonas
|
|
* ks/dialyzer:
dialyzer: Build the PLT even if there are unresolved remote types
proplists: Export the type property()
erl_lint: Issue warnings for undefined exported types
Minor fix in a print message
Add handling of unknown types
Add declaration for exported types
Add types and specs; performed some cleanups also
erl_scan: Add declarations for exported types
stdlib: Add declarations for exported types
hipe: Add declarations for exported types
compiler: Add declarations for exported types
syntax_tools: Add declarations for exported types
kernel: Add declaration for exported types
Support -export_type() in dialyzer and erl_types
Add infrastructure for the -export_type() attribute
OTP-8678 ks/dialyzer
|
|
|
|
|
|
|
|
|
|
While at it, added some types to a record
and did some cleanups suggested by tidier.
|
|
|
|
erl_lint has been updated so that it takes the new -export_type()
attribute into account.
This means:
- do not complain about types which are defined but nowhere used in the
module but exported to other modules
- check that all types which are exported are indeed defined in the module
- warn when there are multiple occurrences of exported types.
In doing this change, I've also taken the liberty to introduce many types and
specs for functions of this module and to do small cleanups here and there.
|
|
The Erlang code preprocessor (epp) did not correctly handle premature
end-of-input when defining macros. This bug, introduced in STDLIB 1.16, has
been fixed.
|
|
|
|
|
|
|
|
|
|
|
|
Wrote and changed some tests in stdlib:erl_lint_SUITE
nowarn_bif_clash is obsoleted but will remove warnings and errors about bif
clashes. The recommended way is to use no_auto_import directives instead.
Hopefully erlang.erl is the only user in the world of nowarn_bif_clash.
|
|
Added only a few testcases in compiler:error_SUITE and guard_SUITE
The new behaviour of warnings and errors when overriding autoimported BIF's:
Bifs that were autoimported before R14 are dangerous because old code
using them and overriding them in exports can start behaving
differently. For newly added autoimports this can't happen to the new
code that wants to (or dont want to) use them, why only warnings are
added for the BIFs autoimported after the compilator change. Errors
are issued only for code that could have worked in one way in R13 and
now will behave in a different way.
If overriding autoimport with local function:
- if explicit -compile directive supresses autoimport
-> no message
else
- if called from inside module
- if pre R14 autoimported bif
-> error
else
-> warning
else
-> no message
If overriding autoimport with import directive
- if explicit -compile directive supresses autoimport
-> no message
else (regardless of actual usage)
- if pre R14 autoimported bif
-> error
else
-> warning
Calls of local functions or imports overriding autoimported functions
(either post R14 or by using explicit -compile supressions of
autoimport) always goes to the local function or the imported.
The compileation errors are added to not let code like this silently
and disastrously change its semantic (probably to an infinite loop)
between R13 and R14:
----------
-module(m).
-export([length/1]).
length(X) ->
...
Y = length(Z),
....
----------
The user has to select if he/she wants to call length in 'erlang' explicitly
or if the overriding semantics is desired, in which case the -compile
directive has to be used.
-compile({no_auto_import,[F/A]}). Is added to allow to override the
autoimports so that code gets unanbiguous. The directive will remove
an autoimport even if there is no local function or import overriding,
because any other behaviour would be inconsistent and confusing.
record_info and module_info can never be overridden.
|
|
|
|
Import directives still not sorted out!
|
|
Expressions evaluating to integers can now be used in types and function
specifications where hitherto only integers were allowed
("Erlang_Integer").
|
|
* jv/autoimport-binary_to_term_2:
Change binary_to_term/2 to be auto-imported
OTP-8671 jv/autoimport-binary_to_term_2
Now, binary_to_term/2 is auto-imported. This will cause a compile warning
if and only if a module has got a local function with that name.
|
|
The compiler currently generates better code for:
f(#r1{}) -> r1;
f(#r2{}) -> r2;
f(#r3{}) -> r3.
than for:
g(X) when is_record(X, r1) -> r1;
g(X) when is_record(X, r2) -> r2;
g(X) when is_record(X, r3) -> r3.
The compiler generates good code for pattern matching (as in f/1),
but in g/1 there are no patterns to match, and the clause to be
executed must be chosen by evaluating the guards sequentially
until one succeeds.
Make the compiler generate better code by replacing calls to
is_record() with matching in the function head (basically,
g/1 will automatically be rewritten to do pattern matching
as in f/1).
Note that this rewrite will also benefit code such as:
h(X) when X#r1.a =:= 1 -> ok.
because it would have been rewritten to:
h(X) when (is_record(X, r1, 3) orelse fail) and (element(2, X) =:= 1) ->
ok.
which in turn will be rewritten to:
h({r1,_,_}=X) when (true orelse fail) and (element(2, X) =:= 1) ->
ok.
(That will be further simplified in later compiler passes.)
|
|
The Erlang scanner has been augmented with two new tokens: .. and ....
|
|
The gen_fsm, gen_server, and wx_object format_status implementations
fail to handle global names of the form {global, term()} where term()
is something other than an atom, pid, or list. Change these
format_status implementations to treat names that are atoms, pids, or
lists as before, but for all other terms, set the header property of
the function return value to a tuple whose first element is a string
describing the return value and whose second element is the name term.
Add unit tests for gen_server and gen_fsm to verify sys:get_status
calls work successfully for globally registered instances.
|
|
While binary_to_term/2 was added in R13B04, it wasn't auto-imported. This
conformed to longstanding policy of not changing auto-imports between major
versions. This patch contains changes to auto-import binary_to_term/2 to
coincide with the release of R14.
|
|
* sv/format_status_error_info:
Add support for the format_status callback to gen_event
Extend format_status for gen_server/gen_fsm termination error logging
OTP-8630 sv/format_status_error_info
When a gen_server, gen_fsm process, or gen_event terminates abnormally,
sometimes the text representation of the process state can occupy many
lines of the error log, depending on the definition of the state term. A
mechanism to trim out parts of the state from the log has been added (using
a format_status/2 callback). See the documentation.
|
|
* pan/otp_8217_binary:
Add documentation for binary module
Add more tests and make some go easier on small systems
Correct Boyer More and trapping for longest_common_suffix
Add longer timetrap to testcases and add binary to app file
Add guard BIFs binary_part/2,3
Add binary:{encode,decode}_unsigned({1,2}
Add referenced_byte_size/1
Add binary:list_to_bin/1 and binary:copy/1,2
Add bin_to_list/{1,2,3}
Add binary:longest_common_prefix/longest_common_suffix
Add binary:part to erl_bif_binary.c
Move binary module bif's to erl_bif_binary.c
Count reductions for process even when not trapping
Add random compare testcase
Teach BIF's binary:match/matches interrupting/restarting
Teach binary.c the semantics to take longest instead of shortest match
Initial commit of the binary EEP
OTP-8217 Implement EEP31
The module binary from EEP31 (and EEP9) is implemented.
|
|
* dp/shell-line-editing:
Readline-style line edit history
OTP-8635 dp/shell-line-editing
The shell's line editing has been improved to more resemble the behaviour
of readline and other shells. (Thanks to Dave Peticolas)
|
|
|
|
Add the gc_bif's to the VM.
Add infrastructure for gc_bif's (guard bifs that can gc) with two and.
three arguments in VM (loader and VM).
Add compiler support for gc_bif with three arguments.
Add compiler (and interpreter) support for new guard BIFs.
Add testcases for new guard BIFs in compiler and emulator.
|