Age | Commit message (Collapse) | Author |
|
|
|
* 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
|
|
|
|
|
|
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.
|
|
* origin/pan/otp_8579_autoimport_override:
Update preloaded modules
Update primary bootstrap
Remove outcommented code from erl_lint
Make port_command/3 auto-imported
Remove (harmless) warnings about min/max in core applications
Autoimport min/2 and max/2
Improve coverage of erl_int in testcases
Change warning to error for nowarn_bif_clash compiler directive
Add -compile({no_auto_import,[F/A]}) doc to compiler.xml
Add some testcases to compiler to verify that overriding really happens
Return nowarn_bif_clash functionality but with warning
Teach erl_lint to better override BIFs with local functions and imports
Teach compiler to override autoimport with import
First prototype for local functions overriding autoimported
OTP-8579 Local functions should override auto-imported
Local and imported functions now override the autoimported
BIFs when the names clash. The pre R14 behaviour was that
autoimported BIFs would override local functions. To avoid
that old programs change behaviour, the following will
generate an error:
Doing a call without explicit module name to a local function
having a name clashing with the name of an autoimported BIF
that was present (and autoimported) before OTP R14A
Explicitly importing a function having a name clashing with
the name of an autoimported BIF that was present (and
autoimported) before OTP R14A Using any form of the old
compiler directive nowarn_bif_clash
If the BIF was added or autoimported in OTP R14A or later,
overriding it with an import or a local function will only
result in a warning,
To resolve clashes, you can either use the explicit module
name erlang to call the BIF, or you can remove the autoimport
of that specific BIF by using the new compiler directive
-compile({no_auto_import,[F/A]})., which makes all calls to
the local or imported function without explicit module name
pass without warnings or errors.
The change makes it possible to add autoimported BIFs without
breaking or silently changing old code in the future. However
some current code ingeniously utilizing the old behaviour or
the nowarn_bif_clash compiler directive, might need changing
to be accepted by the compiler.
|
|
* pan/otp_8577_re_pattern_doc:
Add documentation of what part of a re mp() can be used for guard tests
OTP-8577 Document re_pattern properties
Some properties of a compiled re pattern are defined to allow for guard
tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 erl_expand_records compiler pass translates the
following code:
h(X) when X#r1.a =:= 1 -> ok.
to (essentially):
h({r1,V1,V2}=X) when element(2, X) =:= 1 -> ok.
Since the guard can only be executed when the pattern matching
has succeeded, we know that the second element in the tuple X
must have been bound to V2. Thus we can eliminate the call
to element/2 like this:
h({r1,V1,V2}=X) when V1 =:= 1 -> ok.
|
|
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.
|
|
Signed-off-by: Tuncer Ayaz <[email protected]>
|
|
* 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)
|
|
Correct behaviour of copy/2 witn 0 copies.
|
|
Even more tests added to cover more error cases, some tests
made easier on systems with small memories and timeouts made longer
due to timetraps on solaris daily builds.
|
|
Add testcases and clean up to get better code coverage.
|